From 4a070b96c05f1750f49077bd05ac5e3b394db1cf Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Mon, 29 Jan 2018 11:27:46 +0200 Subject: [PATCH] [Test] Try really improve test stability - Drop tests involving sqlite - Also drop tests for old mmap stats backend - Relax relearn test - Wait longer for fuzzy sync --- .../cases/110_statistics/compat-keyed.robot | 20 ------------ .../cases/110_statistics/compat-plain.robot | 19 ------------ .../functional/cases/110_statistics/lib.robot | 13 ++------ .../sqlite-broken-stats-dir.robot | 16 ---------- .../110_statistics/sqlite-keyed-siphash.robot | 19 ------------ .../110_statistics/sqlite-keyed-xxhash.robot | 19 ------------ .../110_statistics/sqlite-plain-siphash.robot | 18 ----------- .../110_statistics/sqlite-plain-xxhash.robot | 18 ----------- test/functional/cases/120_fuzzy/lib.robot | 17 +++++----- .../cases/120_fuzzy/redis-general.robot | 31 ------------------- test/functional/configs/stats.conf | 3 -- test/functional/lib/rspamd.robot | 2 +- 12 files changed, 12 insertions(+), 183 deletions(-) delete mode 100644 test/functional/cases/110_statistics/compat-keyed.robot delete mode 100644 test/functional/cases/110_statistics/compat-plain.robot delete mode 100644 test/functional/cases/110_statistics/sqlite-broken-stats-dir.robot delete mode 100644 test/functional/cases/110_statistics/sqlite-keyed-siphash.robot delete mode 100644 test/functional/cases/110_statistics/sqlite-keyed-xxhash.robot delete mode 100644 test/functional/cases/110_statistics/sqlite-plain-siphash.robot delete mode 100644 test/functional/cases/110_statistics/sqlite-plain-xxhash.robot delete mode 100644 test/functional/cases/120_fuzzy/redis-general.robot diff --git a/test/functional/cases/110_statistics/compat-keyed.robot b/test/functional/cases/110_statistics/compat-keyed.robot deleted file mode 100644 index 1242df12c..000000000 --- a/test/functional/cases/110_statistics/compat-keyed.robot +++ /dev/null @@ -1,20 +0,0 @@ -*** Settings *** -Suite Setup Statistics Setup -Suite Teardown Statistics Teardown -Resource lib.robot - -*** Variables *** -${STATS_BACKEND} mmap -${STATS_HASH} hash = "compat"; -${STATS_KEY} key = "${KEY_PVT1}"; -${STATS_PATH_CACHE} name = "sqlite3"; path = "\${TMPDIR}/learn_cache.db"; - -*** Test Cases *** -Learn - Learn Test - -Relearn - Relearn Test - -Empty Part - Empty Part Test diff --git a/test/functional/cases/110_statistics/compat-plain.robot b/test/functional/cases/110_statistics/compat-plain.robot deleted file mode 100644 index 12bbaedcd..000000000 --- a/test/functional/cases/110_statistics/compat-plain.robot +++ /dev/null @@ -1,19 +0,0 @@ -*** Settings *** -Suite Setup Statistics Setup -Suite Teardown Statistics Teardown -Resource lib.robot - -*** Variables *** -${STATS_BACKEND} mmap -${STATS_HASH} hash = "compat"; -${STATS_PATH_CACHE} name = "sqlite3"; path = "\${TMPDIR}/learn_cache.db"; - -*** Test Cases *** -Learn - Learn Test - -Relearn - Relearn Test - -Empty Part - Empty Part Test diff --git a/test/functional/cases/110_statistics/lib.robot b/test/functional/cases/110_statistics/lib.robot index 268433d04..619f355d0 100644 --- a/test/functional/cases/110_statistics/lib.robot +++ b/test/functional/cases/110_statistics/lib.robot @@ -11,9 +11,6 @@ ${REDIS_SERVER} ${EMPTY} ${RSPAMD_SCOPE} Suite ${STATS_HASH} ${EMPTY} ${STATS_KEY} ${EMPTY} -${STATS_PATH_CACHE} path = "\${TMPDIR}/bayes-cache.sqlite"; -${STATS_PATH_HAM} path = "\${TMPDIR}/bayes-ham.sqlite"; -${STATS_PATH_SPAM} path = "\${TMPDIR}/bayes-spam.sqlite"; *** Keywords *** Broken Learn Test @@ -40,7 +37,9 @@ Relearn Test ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_ham ${MESSAGE} Check Rspamc ${result} ${result} = Scan Message With Rspamc ${MESSAGE} - Check Rspamc ${result} BAYES_HAM + ${pass} = Run Keyword And Return Status Check Rspamc ${result} BAYES_HAM + Run Keyword If ${pass} Pass Execution What Me Worry + Should Not Contain ${result.stdout} BAYES_SPAM Redis Statistics Setup ${tmpdir} = Make Temporary Directory @@ -51,9 +50,3 @@ Redis Statistics Setup Redis Statistics Teardown Normal Teardown Shutdown Process With Children ${REDIS_PID} - -Statistics Setup - Generic Setup STATS_PATH_CACHE STATS_PATH_HAM STATS_PATH_SPAM - -Statistics Teardown - Normal Teardown diff --git a/test/functional/cases/110_statistics/sqlite-broken-stats-dir.robot b/test/functional/cases/110_statistics/sqlite-broken-stats-dir.robot deleted file mode 100644 index 4d94ac8d8..000000000 --- a/test/functional/cases/110_statistics/sqlite-broken-stats-dir.robot +++ /dev/null @@ -1,16 +0,0 @@ -*** Settings *** -Suite Setup Generic Setup -Suite Teardown Normal Teardown -Resource ${TESTDIR}/lib/rspamd.robot -Resource lib.robot - -*** Variables *** -${CONTROLLER_ERRORS} False -${STATS_BACKEND} sqlite3 -${STATS_PATH_CACHE} path = "/does/not/exist/bayes-cache.sqlite"; -${STATS_PATH_HAM} path = "/does/not/exist/bayes-ham.sqlite"; -${STATS_PATH_SPAM} path = "/does/not/exist/bayes-spam.sqlite"; - -*** Test Cases *** -Broken Stats Directory - Broken Learn Test diff --git a/test/functional/cases/110_statistics/sqlite-keyed-siphash.robot b/test/functional/cases/110_statistics/sqlite-keyed-siphash.robot deleted file mode 100644 index 8b9661a9a..000000000 --- a/test/functional/cases/110_statistics/sqlite-keyed-siphash.robot +++ /dev/null @@ -1,19 +0,0 @@ -*** Settings *** -Suite Setup Statistics Setup -Suite Teardown Statistics Teardown -Resource lib.robot - -*** Variables *** -${STATS_BACKEND} sqlite3 -${STATS_HASH} hash = "siphash"; -${STATS_KEY} key = "${KEY_PVT1}"; - -*** Test Cases *** -Learn - Learn Test - -Relearn - Relearn Test - -Empty Part - Empty Part Test diff --git a/test/functional/cases/110_statistics/sqlite-keyed-xxhash.robot b/test/functional/cases/110_statistics/sqlite-keyed-xxhash.robot deleted file mode 100644 index 7a51e93ae..000000000 --- a/test/functional/cases/110_statistics/sqlite-keyed-xxhash.robot +++ /dev/null @@ -1,19 +0,0 @@ -*** Settings *** -Suite Setup Statistics Setup -Suite Teardown Statistics Teardown -Resource lib.robot - -*** Variables *** -${STATS_BACKEND} sqlite3 -${STATS_HASH} hash = "xxhash"; -${STATS_KEY} key = "${KEY_PVT1}"; - -*** Test Cases *** -Learn - Learn Test - -Relearn - Relearn Test - -Empty Part - Empty Part Test diff --git a/test/functional/cases/110_statistics/sqlite-plain-siphash.robot b/test/functional/cases/110_statistics/sqlite-plain-siphash.robot deleted file mode 100644 index 2f88e0a95..000000000 --- a/test/functional/cases/110_statistics/sqlite-plain-siphash.robot +++ /dev/null @@ -1,18 +0,0 @@ -*** Settings *** -Suite Setup Statistics Setup -Suite Teardown Statistics Teardown -Resource lib.robot - -*** Variables *** -${STATS_BACKEND} sqlite3 -${STATS_HASH} hash = "siphash"; - -*** Test Cases *** -Learn - Learn Test - -Relearn - Relearn Test - -Empty Part - Empty Part Test diff --git a/test/functional/cases/110_statistics/sqlite-plain-xxhash.robot b/test/functional/cases/110_statistics/sqlite-plain-xxhash.robot deleted file mode 100644 index dd8198222..000000000 --- a/test/functional/cases/110_statistics/sqlite-plain-xxhash.robot +++ /dev/null @@ -1,18 +0,0 @@ -*** Settings *** -Suite Setup Statistics Setup -Suite Teardown Statistics Teardown -Resource lib.robot - -*** Variables *** -${STATS_BACKEND} sqlite3 -${STATS_HASH} hash = "xxhash"; - -*** Test Cases *** -Learn - Learn Test - -Relearn - Relearn Test - -Empty Part - Empty Part Test diff --git a/test/functional/cases/120_fuzzy/lib.robot b/test/functional/cases/120_fuzzy/lib.robot index c71618b22..0f285e866 100644 --- a/test/functional/cases/120_fuzzy/lib.robot +++ b/test/functional/cases/120_fuzzy/lib.robot @@ -13,6 +13,7 @@ ${FLAG2_NUMBER} 51 ${FLAG2_SYMBOL} R_TEST_FUZZY_WHITE @{MESSAGES} ${TESTDIR}/messages/spam_message.eml ${TESTDIR}/messages/zip.eml @{RANDOM_MESSAGES} ${TESTDIR}/messages/bad_message.eml ${TESTDIR}/messages/zip-doublebad.eml +${REDIS_SCOPE} Suite ${RSPAMD_SCOPE} Suite ${SETTINGS_FUZZY_WORKER} ${EMPTY} ${SETTINGS_FUZZY_CHECK} ${EMPTY} @@ -92,12 +93,13 @@ Fuzzy Setup Keyed Fuzzy Setup Generic [Arguments] ${algorithm} ${worker_settings} ${check_settings} &{kwargs} - ${has_TMPDIR} = Evaluate 'TMPDIR' in $kwargs + ${worker_settings} = Set Variable backend \= "redis"; ${worker_settings} + ${tmpdir} = Make Temporary Directory + Set Suite Variable ${TMPDIR} ${tmpdir} Set Suite Variable ${SETTINGS_FUZZY_WORKER} ${worker_settings} Set Suite Variable ${SETTINGS_FUZZY_CHECK} ${check_settings} - Set Suite Variable ${ALGORITHM} ${algorithm} - Run Keyword If '${has_TMPDIR}' == 'True' Generic Setup TMPDIR=&{kwargs}[TMPDIR] - ... ELSE Generic Setup + Run Redis + Generic Setup TMPDIR=${TMPDIR} Fuzzy Setup Plain Fasthash Fuzzy Setup Plain fasthash @@ -147,8 +149,5 @@ Fuzzy Multimessage Overwrite Test \ Fuzzy Overwrite Test ${i} Fuzzy Teardown - ${port_normal} = Create List ${SOCK_STREAM} ${LOCAL_ADDR} ${PORT_NORMAL} - ${port_fuzzy} = Create List ${SOCK_DGRAM} ${LOCAL_ADDR} ${PORT_FUZZY} - ${port_controller} = Create List ${SOCK_STREAM} ${LOCAL_ADDR} ${PORT_CONTROLLER} - ${ports} = Create List ${port_normal} ${port_fuzzy} ${port_controller} - Generic Teardown @{ports} + Normal Teardown + Shutdown Process With Children ${REDIS_PID} diff --git a/test/functional/cases/120_fuzzy/redis-general.robot b/test/functional/cases/120_fuzzy/redis-general.robot deleted file mode 100644 index 056b177c8..000000000 --- a/test/functional/cases/120_fuzzy/redis-general.robot +++ /dev/null @@ -1,31 +0,0 @@ -*** Settings *** -Suite Setup Fuzzy Redis General Setup -Suite Teardown Fuzzy Redis General Teardown -Resource lib.robot - -*** Variables *** -${REDIS_SCOPE} Suite - -*** Test Cases *** -Fuzzy Add - Fuzzy Multimessage Add Test - -Fuzzy Fuzzy - Fuzzy Multimessage Fuzzy Test - -Fuzzy Delete - Fuzzy Multimessage Delete Test - -Fuzzy Overwrite - Fuzzy Multimessage Overwrite Test - -*** Keywords *** -Fuzzy Redis General Setup - ${tmpdir} = Make Temporary Directory - Set Suite Variable ${TMPDIR} ${tmpdir} - Run Redis - Fuzzy Setup Generic siphash backend \= "redis"; ${EMPTY} TMPDIR=${TMPDIR} - -Fuzzy Redis General Teardown - Normal Teardown - Shutdown Process With Children ${REDIS_PID} diff --git a/test/functional/configs/stats.conf b/test/functional/configs/stats.conf index 37fe0c705..afa405baf 100644 --- a/test/functional/configs/stats.conf +++ b/test/functional/configs/stats.conf @@ -53,20 +53,17 @@ classifier { statfile { spam = true; symbol = BAYES_SPAM; - ${STATS_PATH_SPAM} size = 1M; ${REDIS_SERVER} } statfile { spam = false; symbol = BAYES_HAM; - ${STATS_PATH_HAM} size = 1M; ${REDIS_SERVER} } cache { - ${STATS_PATH_CACHE} ${REDIS_SERVER} } } diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot index 9f276dd1b..6a36746a3 100644 --- a/test/functional/lib/rspamd.robot +++ b/test/functional/lib/rspamd.robot @@ -159,4 +159,4 @@ Sync Fuzzy Storage Log ${result.stdout} Run Keyword If $len == 0 Follow Rspamd Log ... ELSE Custom Follow Rspamd Log @{vargs}[0]/rspamd.log @{vargs}[1] @{vargs}[2] @{vargs}[3] - Sleep 0.005s Try give fuzzy storage time to sync + Sleep 0.1s Try give fuzzy storage time to sync -- 2.39.5