From d82d3a9e656d5baaee748d3ae7d3282dc6719c94 Mon Sep 17 00:00:00 2001 From: kssenii Date: Tue, 30 Mar 2021 18:48:33 +0000 Subject: [PATCH 1/3] Try fix flaky rabbitmq test --- tests/integration/test_storage_rabbitmq/test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/test_storage_rabbitmq/test.py b/tests/integration/test_storage_rabbitmq/test.py index ca89ebdea0a..bb8da289490 100644 --- a/tests/integration/test_storage_rabbitmq/test.py +++ b/tests/integration/test_storage_rabbitmq/test.py @@ -258,6 +258,7 @@ def test_rabbitmq_tsv_with_delimiter(rabbitmq_cluster): SETTINGS rabbitmq_host_port = 'rabbitmq1:5672', rabbitmq_exchange_name = 'tsv', rabbitmq_format = 'TSV', + rabbitmq_queue_base = 'tsv', rabbitmq_row_delimiter = '\\n'; ''') From 47431df7ce954d239daed0ee52f3d1d874a0819e Mon Sep 17 00:00:00 2001 From: Kseniia Sumarokova <54203879+kssenii@users.noreply.github.com> Date: Tue, 30 Mar 2021 22:18:03 +0300 Subject: [PATCH 2/3] Update test.py --- tests/integration/test_storage_rabbitmq/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_storage_rabbitmq/test.py b/tests/integration/test_storage_rabbitmq/test.py index bb8da289490..5ea3d19ebfe 100644 --- a/tests/integration/test_storage_rabbitmq/test.py +++ b/tests/integration/test_storage_rabbitmq/test.py @@ -275,7 +275,7 @@ def test_rabbitmq_tsv_with_delimiter(rabbitmq_cluster): channel.basic_publish(exchange='tsv', routing_key='', body=message) connection.close() - time.sleep(1) + time.sleep(2) result = '' while True: From f2a8e40012424411dcac8f91a8685086cca651e7 Mon Sep 17 00:00:00 2001 From: kssenii Date: Wed, 31 Mar 2021 07:37:34 +0000 Subject: [PATCH 3/3] Do not rely on time --- tests/integration/test_storage_rabbitmq/test.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_storage_rabbitmq/test.py b/tests/integration/test_storage_rabbitmq/test.py index bb8da289490..e489c2a134f 100644 --- a/tests/integration/test_storage_rabbitmq/test.py +++ b/tests/integration/test_storage_rabbitmq/test.py @@ -253,6 +253,8 @@ def test_rabbitmq_csv_with_delimiter(rabbitmq_cluster): @pytest.mark.timeout(240) def test_rabbitmq_tsv_with_delimiter(rabbitmq_cluster): instance.query(''' + DROP TABLE IF EXISTS test.view; + DROP TABLE IF EXISTS test.consumer; CREATE TABLE test.rabbitmq (key UInt64, value UInt64) ENGINE = RabbitMQ SETTINGS rabbitmq_host_port = 'rabbitmq1:5672', @@ -260,6 +262,11 @@ def test_rabbitmq_tsv_with_delimiter(rabbitmq_cluster): rabbitmq_format = 'TSV', rabbitmq_queue_base = 'tsv', rabbitmq_row_delimiter = '\\n'; + CREATE TABLE test.view (key UInt64, value UInt64) + ENGINE = MergeTree() + ORDER BY key; + CREATE MATERIALIZED VIEW test.consumer TO test.view AS + SELECT * FROM test.rabbitmq; ''') credentials = pika.PlainCredentials('root', 'clickhouse') @@ -275,11 +282,10 @@ def test_rabbitmq_tsv_with_delimiter(rabbitmq_cluster): channel.basic_publish(exchange='tsv', routing_key='', body=message) connection.close() - time.sleep(1) result = '' while True: - result += instance.query('SELECT * FROM test.rabbitmq ORDER BY key', ignore_error=True) + result = instance.query('SELECT * FROM test.view ORDER BY key') if rabbitmq_check_result(result): break