From 66cd8b6e3bf4972ac65b708716b08efc5bdc8bee Mon Sep 17 00:00:00 2001 From: Michal Bobowski Date: Fri, 15 Nov 2024 11:34:30 +0100 Subject: [PATCH] SNOW-1728000 WIP Iceberg e2e tests --- .../iceberg_avro_aws.json | 28 ++++++++++ .../iceberg_json_aws.json | 9 ++-- test/run_test_confluent.sh | 4 +- test/test_data/avro/README.txt | 2 + test/test_data/avro/steve.avro | Bin 0 -> 465 bytes test/test_data/avro/steve.json | 7 +++ test/test_data/avro/test_user.avsc | 33 ++++++++++++ test/test_suit/assertions.py | 26 +++++++++ test/test_suit/base_iceberg_test.py | 27 ++++++++++ test/test_suit/iceberg_avro_aws.py | 46 ++++++++++++++++ test/test_suit/iceberg_json_aws.py | 34 ++++++++---- test/test_suites.py | 50 +++++++++++------- 12 files changed, 229 insertions(+), 37 deletions(-) create mode 100644 test/rest_request_template/iceberg_avro_aws.json create mode 100644 test/test_data/avro/README.txt create mode 100644 test/test_data/avro/steve.avro create mode 100644 test/test_data/avro/steve.json create mode 100644 test/test_data/avro/test_user.avsc create mode 100644 test/test_suit/assertions.py create mode 100644 test/test_suit/base_iceberg_test.py create mode 100644 test/test_suit/iceberg_avro_aws.py diff --git a/test/rest_request_template/iceberg_avro_aws.json b/test/rest_request_template/iceberg_avro_aws.json new file mode 100644 index 000000000..150e3d151 --- /dev/null +++ b/test/rest_request_template/iceberg_avro_aws.json @@ -0,0 +1,28 @@ +{ + "name": "SNOWFLAKE_CONNECTOR_NAME", + "config": { + "connector.class": "com.snowflake.kafka.connector.SnowflakeSinkConnector", + "topics": "SNOWFLAKE_TEST_TOPIC", + "tasks.max": "1", + "buffer.size.bytes": "5000000", + "snowflake.url.name": "SNOWFLAKE_HOST", + "snowflake.user.name": "SNOWFLAKE_USER", + "snowflake.private.key": "SNOWFLAKE_PRIVATE_KEY", + "snowflake.database.name": "SNOWFLAKE_DATABASE", + "snowflake.schema.name": "SNOWFLAKE_SCHEMA", + "snowflake.role.name": "SNOWFLAKE_ROLE", + "snowflake.ingestion.method": "SNOWPIPE_STREAMING", + "key.converter": "org.apache.kafka.connect.storage.StringConverter", + "value.converter":"io.confluent.connect.avro.AvroConverter", + "value.converter.schema.registry.url":"CONFLUENT_SCHEMA_REGISTRY", + "value.converter.schemas.enable": "false", + "jmx": "true", + "errors.tolerance": "all", + "errors.log.enable": true, + "errors.deadletterqueue.topic.name": "DLQ_TOPIC", + "errors.deadletterqueue.topic.replication.factor": 1, + "snowflake.streaming.iceberg.enabled": true, + "snowflake.streaming.max.client.lag": "1", + "snowflake.streaming.enable.single.buffer": "true" + } +} \ No newline at end of file diff --git a/test/rest_request_template/iceberg_json_aws.json b/test/rest_request_template/iceberg_json_aws.json index d4b19c67f..873acbdf0 100644 --- a/test/rest_request_template/iceberg_json_aws.json +++ b/test/rest_request_template/iceberg_json_aws.json @@ -4,8 +4,6 @@ "connector.class": "com.snowflake.kafka.connector.SnowflakeSinkConnector", "topics": "SNOWFLAKE_TEST_TOPIC", "tasks.max": "1", - "buffer.flush.time": "10", - "buffer.count.records": "100", "buffer.size.bytes": "5000000", "snowflake.url.name": "SNOWFLAKE_HOST", "snowflake.user.name": "SNOWFLAKE_USER", @@ -14,9 +12,6 @@ "snowflake.schema.name": "SNOWFLAKE_SCHEMA", "snowflake.role.name": "SNOWFLAKE_ROLE", "snowflake.ingestion.method": "SNOWPIPE_STREAMING", - "snowflake.streaming.enable.single.buffer": true, - "snowflake.streaming.closeChannelsInParallel.enabled": true, - "snowflake.enable.schematization": "false", "key.converter": "org.apache.kafka.connect.storage.StringConverter", "value.converter": "org.apache.kafka.connect.json.JsonConverter", "value.converter.schemas.enable": "false", @@ -25,6 +20,8 @@ "errors.log.enable": true, "errors.deadletterqueue.topic.name": "DLQ_TOPIC", "errors.deadletterqueue.topic.replication.factor": 1, - "snowflake.streaming.iceberg.enabled": true + "snowflake.streaming.iceberg.enabled": true, + "snowflake.streaming.max.client.lag": "1", + "snowflake.streaming.enable.single.buffer": "true" } } \ No newline at end of file diff --git a/test/run_test_confluent.sh b/test/run_test_confluent.sh index e3e584e44..d0afb62d8 100755 --- a/test/run_test_confluent.sh +++ b/test/run_test_confluent.sh @@ -135,7 +135,7 @@ ls $KAFKA_CONNECT_PLUGIN_PATH echo "Copying connect-log4j.properties file to confluent folder" cp -fr ./connect-log4j.properties $CONFLUENT_FOLDER_NAME/"etc/kafka/" -compile_protobuf_converter_and_data $TEST_SET $CONFLUENT_FOLDER_NAME +#compile_protobuf_converter_and_data $TEST_SET $CONFLUENT_FOLDER_NAME trap "pkill -9 -P $$" SIGINT SIGTERM EXIT @@ -174,7 +174,7 @@ python3 test_verify.py $SNOWFLAKE_KAFKA_ADDRESS http://$LOCAL_IP:$SC_PORT $LOCAL # record_thread_count 2>&1 & # Send test data and verify DB result from Python -python3 test_verify.py $SNOWFLAKE_KAFKA_ADDRESS http://$LOCAL_IP:$SC_PORT $LOCAL_IP:$KC_PORT $TEST_SET $CONFLUENT_VERSION $NAME_SALT $PRESSURE $SSL $SKIP_PROXY $TESTS +python3 -u test_verify.py $SNOWFLAKE_KAFKA_ADDRESS http://$LOCAL_IP:$SC_PORT $LOCAL_IP:$KC_PORT $TEST_SET $CONFLUENT_VERSION $NAME_SALT $PRESSURE $SSL $SKIP_PROXY $TESTS testError=$? # delete_connectors_with_salt $NAME_SALT $LOCAL_IP $KC_PORT diff --git a/test/test_data/avro/README.txt b/test/test_data/avro/README.txt new file mode 100644 index 000000000..bf9b4d22a --- /dev/null +++ b/test/test_data/avro/README.txt @@ -0,0 +1,2 @@ +Avro binary file generated from json: +java -jar avro-tools-1.12.0.jar fromjson --schema-file test_user.avsc steve.json > steve.avro \ No newline at end of file diff --git a/test/test_data/avro/steve.avro b/test/test_data/avro/steve.avro new file mode 100644 index 0000000000000000000000000000000000000000..0e9ad8db5ea4c86cc20aee94b2fdf6086f65a050 GIT binary patch literal 465 zcmZXQO-chn5QUQvVF)fHhzIC}t1t)1(x06o__GojDm~S)O;1G?2SitAOLWH?PF%}*r`CN>Ig`(N-k;4O{ z-ze-rHnOB5WlOKhzzowFs2QY^tVJ29@hXibXEAg$gvcORQP)rP@%ncq