From 701419544ded2fe5c07dd5f614e4edce65d1cc28 Mon Sep 17 00:00:00 2001 From: Anton Yuzhaninov Date: Wed, 24 Oct 2018 18:46:11 -0400 Subject: Add variable for clickhouse port --- test/functional/cases/210_clickhouse/001_migration.robot | 1 + test/functional/cases/210_clickhouse/clickhouse.py | 2 +- test/functional/configs/clickhouse-config.xml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/functional/cases/210_clickhouse/001_migration.robot b/test/functional/cases/210_clickhouse/001_migration.robot index c2db5b3ec..f54f5c4a2 100644 --- a/test/functional/cases/210_clickhouse/001_migration.robot +++ b/test/functional/cases/210_clickhouse/001_migration.robot @@ -11,6 +11,7 @@ Test Teardown Clickhosue Teardown *** Variables *** ${CONFIG} ${TESTDIR}/configs/clickhouse.conf ${RSPAMD_SCOPE} Suite +${CLICKHOUSE_PORT} ${18123} *** Test Cases *** Initial schema diff --git a/test/functional/cases/210_clickhouse/clickhouse.py b/test/functional/cases/210_clickhouse/clickhouse.py index 4e95eadf6..f5e4646cd 100644 --- a/test/functional/cases/210_clickhouse/clickhouse.py +++ b/test/functional/cases/210_clickhouse/clickhouse.py @@ -8,7 +8,7 @@ __client = None class Client: def __init__(self): - self.port = 18123 + self.port = BuiltIn().get_variable_value('${CLICKHOUSE_PORT}', default=18123) def get_query_string(self): return "http://localhost:%d/?default_format=JSONEachRow" % (self.port) diff --git a/test/functional/configs/clickhouse-config.xml b/test/functional/configs/clickhouse-config.xml index 10530a580..b210748ba 100644 --- a/test/functional/configs/clickhouse-config.xml +++ b/test/functional/configs/clickhouse-config.xml @@ -10,7 +10,7 @@ - 18123 + ${CLICKHOUSE_PORT} 19000 -- cgit v1.2.3 From 7ed06f8104c52bb1f3f3fa491dd01102f2aece10 Mon Sep 17 00:00:00 2001 From: Anton Yuzhaninov Date: Wed, 24 Oct 2018 20:10:14 -0400 Subject: Fix race in Cases.210 Clickhouse.001 Clickhouse test sometimes fails with an error: ConnectionError: HTTPConnectionPool(host='localhost', port=18123): Max retries exceeded with url: /?default_format=JSONEachRow (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',)) Fix this by waiting for TCP port instead pid file. --- test/functional/cases/210_clickhouse/001_migration.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/cases/210_clickhouse/001_migration.robot b/test/functional/cases/210_clickhouse/001_migration.robot index f54f5c4a2..bf6d48084 100644 --- a/test/functional/cases/210_clickhouse/001_migration.robot +++ b/test/functional/cases/210_clickhouse/001_migration.robot @@ -69,7 +69,7 @@ Clickhouse Setup ${result} = Run Process clickhouse-server --daemon --config-file\=${TMPDIR}/clickhouse-config.xml --pid-file\=${TMPDIR}/clickhouse.pid Run Keyword If ${result.rc} != 0 Log ${result.stderr} Should Be Equal As Integers ${result.rc} 0 - Wait Until Keyword Succeeds 5 sec 1 sec Check Pidfile ${TMPDIR}/clickhouse.pid timeout=5 sec + Wait Until Keyword Succeeds 5 sec 50 ms TCP Connect localhost ${CLICKHOUSE_PORT} Set Suite Variable ${TMPDIR} ${TMPDIR} -- cgit v1.2.3 From 96fc8e54298da72e3b6c3580ccdcc6488d6f6014 Mon Sep 17 00:00:00 2001 From: Anton Yuzhaninov Date: Wed, 24 Oct 2018 20:13:58 -0400 Subject: Filter Wait Until Keyword Succeeds in robot log Remove all but the last failing keyword inside `BuiltIn.Wait Until Keyword Succeeds` to reduse amount of useless inforamtion in robot log. --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 787baa6d8..fdfa0d899 100644 --- a/.drone.yml +++ b/.drone.yml @@ -94,7 +94,7 @@ pipeline: # use umask to create world-writable files so nobody can write to *.gcda files created by root - umask 0000 - set +e - - RSPAMD_INSTALLROOT=/rspamd/install robot --exclude isbroken $CI_WORKSPACE/test/functional/cases; EXIT_CODE=$? + - RSPAMD_INSTALLROOT=/rspamd/install robot --exclude isbroken --removekeywords wuks $CI_WORKSPACE/test/functional/cases; EXIT_CODE=$? - set -e # upload test results to nginx frontent using WebDAV PUT - > -- cgit v1.2.3 From 58e4d05f07e988b9a02e88c279b30f05602da8a0 Mon Sep 17 00:00:00 2001 From: Anton Yuzhaninov Date: Wed, 24 Oct 2018 20:16:50 -0400 Subject: Filter Wait Until Keyword Succeeds in robot log Remove all but the last failing keyword inside `BuiltIn.Wait Until Keyword Succeeds` to reduce amount of useless information in robot log. --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index fdfa0d899..19fcc7da2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -94,7 +94,7 @@ pipeline: # use umask to create world-writable files so nobody can write to *.gcda files created by root - umask 0000 - set +e - - RSPAMD_INSTALLROOT=/rspamd/install robot --exclude isbroken --removekeywords wuks $CI_WORKSPACE/test/functional/cases; EXIT_CODE=$? + - RSPAMD_INSTALLROOT=/rspamd/install robot --removekeywords wuks --exclude isbroken $CI_WORKSPACE/test/functional/cases; EXIT_CODE=$? - set -e # upload test results to nginx frontent using WebDAV PUT - > -- cgit v1.2.3 From 43ceedc68fe92ffaeb2f5f3bb41087744018e110 Mon Sep 17 00:00:00 2001 From: Anton Yuzhaninov Date: Wed, 24 Oct 2018 21:08:31 -0400 Subject: TCP Connect robot keyword * reduce timeout to a reasonable value * explicitly close socket, don't wait for GC --- test/functional/lib/rspamd.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/functional/lib/rspamd.py b/test/functional/lib/rspamd.py index e4462c18c..6fc1c0e67 100644 --- a/test/functional/lib/rspamd.py +++ b/test/functional/lib/rspamd.py @@ -160,8 +160,15 @@ def spamc(addr, port, filename): return r.decode('utf-8') def TCP_Connect(addr, port): + """Attempts to open a TCP connection to specified address:port + + Example: + | Wait Until Keyword Succeeds | 5s | 10ms | TCP Connect | localhost | 8080 | + """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.settimeout(5) # seconds s.connect((addr, port)) + s.close() def update_dictionary(a, b): a.update(b) -- cgit v1.2.3