From 3a43b6c6d72461af4ac72f47c8299e3b96c2c567 Mon Sep 17 00:00:00 2001 From: Anton Yuzhaninov Date: Fri, 21 Jun 2019 15:54:56 +0200 Subject: [Minor] Update test to work with current robot version --- test/functional/cases/104_get_from.robot | 8 +++--- test/functional/cases/120_fuzzy/lib.robot | 41 ++++++++++++++++++------------- test/functional/lib/rspamd.robot | 32 ++++++++++++++---------- 3 files changed, 47 insertions(+), 34 deletions(-) diff --git a/test/functional/cases/104_get_from.robot b/test/functional/cases/104_get_from.robot index a81dec559..94f2590a4 100644 --- a/test/functional/cases/104_get_from.robot +++ b/test/functional/cases/104_get_from.robot @@ -11,9 +11,9 @@ ${LUA_SCRIPT} ${TESTDIR}/lua/get_from.lua ${RSPAMD_SCOPE} Suite ${SYMBOL} GET_FROM (0.00) -${SYMBOL1} ${SYMBOL}[,user@example.org,user,example.org] -${SYMBOL2} ${SYMBOL}[First Last,user@example.org,user,example.org] -${SYMBOL3} ${SYMBOL}[First M. Last,user@example.org,user,example.org] +${SYMBOL1} ${SYMBOL}\[,user@example.org,user,example.org] +${SYMBOL2} ${SYMBOL}\[First Last,user@example.org,user,example.org] +${SYMBOL3} ${SYMBOL}\[First M. Last,user@example.org,user,example.org] *** Test Cases *** task:get_from('mime') - address only @@ -30,7 +30,7 @@ task:get_from('mime') - display name task:get_from('mime') - display name Base64 ${result} = Scan Message With Rspamc ${TESTDIR}/messages/from/from_dn_base64.eml - Check Rspamc ${result} ${SYMBOL}[Кириллица,user@example.org,user,example.org] + Check Rspamc ${result} ${SYMBOL}\[Кириллица,user@example.org,user,example.org] task:get_from('mime') - display name and comment ${result} = Scan Message With Rspamc ${TESTDIR}/messages/from/from_dn_comment.eml diff --git a/test/functional/cases/120_fuzzy/lib.robot b/test/functional/cases/120_fuzzy/lib.robot index 0f285e866..c7b3ce768 100644 --- a/test/functional/cases/120_fuzzy/lib.robot +++ b/test/functional/cases/120_fuzzy/lib.robot @@ -47,9 +47,10 @@ Fuzzy Fuzzy Test Run Keyword If ${RSPAMD_FUZZY_ADD_${message}} != 1 Fail "Fuzzy Add was not run" @{path_info} = Path Splitter ${message} @{fuzzy_files} = List Files In Directory @{pathinfo}[0] pattern=@{pathinfo}[1].fuzzy* absolute=1 - : FOR ${i} IN @{fuzzy_files} - \ ${result} = Scan Message With Rspamc ${i} - \ Check Rspamc ${result} ${FLAG1_SYMBOL} + FOR ${i} IN @{fuzzy_files} + ${result} = Scan Message With Rspamc ${i} + Check Rspamc ${result} ${FLAG1_SYMBOL} + END Fuzzy Miss Test [Arguments] ${message} @@ -59,10 +60,11 @@ Fuzzy Miss Test Fuzzy Overwrite Test [Arguments] ${message} ${flag_numbers} = Create List ${FLAG1_NUMBER} ${FLAG2_NUMBER} - : FOR ${i} IN @{flag_numbers} - \ ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -w 10 - \ ... -f ${i} fuzzy_add ${message} - \ Check Rspamc ${result} + FOR ${i} IN @{flag_numbers} + ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -w 10 + ... -f ${i} fuzzy_add ${message} + Check Rspamc ${result} + END Sync Fuzzy Storage ${result} = Scan Message With Rspamc ${message} Follow Rspamd Log @@ -129,24 +131,29 @@ Fuzzy Setup Encrypted Siphash Fuzzy Setup Encrypted siphash Fuzzy Multimessage Add Test - : FOR ${i} IN @{MESSAGES} - \ Fuzzy Add Test ${i} + FOR ${i} IN @{MESSAGES} + Fuzzy Add Test ${i} + END Fuzzy Multimessage Fuzzy Test - : FOR ${i} IN @{MESSAGES} - \ Fuzzy Fuzzy Test ${i} + FOR ${i} IN @{MESSAGES} + Fuzzy Fuzzy Test ${i} + END Fuzzy Multimessage Miss Test - : FOR ${i} IN @{RANDOM_MESSAGES} - \ Fuzzy Miss Test ${i} + FOR ${i} IN @{RANDOM_MESSAGES} + Fuzzy Miss Test ${i} + END Fuzzy Multimessage Delete Test - : FOR ${i} IN @{MESSAGES} - \ Fuzzy Delete Test ${i} + FOR ${i} IN @{MESSAGES} + Fuzzy Delete Test ${i} + END Fuzzy Multimessage Overwrite Test - : FOR ${i} IN @{MESSAGES} - \ Fuzzy Overwrite Test ${i} + FOR ${i} IN @{MESSAGES} + Fuzzy Overwrite Test ${i} + END Fuzzy Teardown Normal Teardown diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot index 7572e78a4..f54f64b48 100644 --- a/test/functional/lib/rspamd.robot +++ b/test/functional/lib/rspamd.robot @@ -23,9 +23,10 @@ Check Rspamc ${inverse} = Evaluate 'inverse' in $kwargs ${re} = Evaluate 're' in $kwargs ${rc} = Set Variable If ${has_rc} == True &{kwargs}[rc] 0 - : FOR ${i} IN @{args} - \ Run Keyword If ${re} == True Check Rspamc Match Regexp ${result.stdout} ${i} ${inverse} - \ ... ELSE Check Rspamc Match String ${result.stdout} ${i} ${inverse} + FOR ${i} IN @{args} + Run Keyword If ${re} == True Check Rspamc Match Regexp ${result.stdout} ${i} ${inverse} + ... ELSE Check Rspamc Match String ${result.stdout} ${i} ${inverse} + END Run Keyword If @{args} == @{EMPTY} Check Rspamc Match Default ${result.stdout} ${inverse} Should Be Equal As Integers ${result.rc} ${rc} @@ -61,10 +62,11 @@ Generic Setup [Arguments] @{vargs} &{kwargs} &{d} = Run Rspamd @{vargs} &{kwargs} ${keys} = Get Dictionary Keys ${d} - : FOR ${i} IN @{keys} - \ Run Keyword If '${RSPAMD_SCOPE}' == 'Suite' Set Suite Variable ${${i}} &{d}[${i}] - \ ... ELSE IF '${RSPAMD_SCOPE}' == 'Test' Set Test Variable ${${i}} &{d}[${i}] - \ ... ELSE Fail 'RSPAMD_SCOPE must be Test or Suite' + FOR ${i} IN @{keys} + Run Keyword If '${RSPAMD_SCOPE}' == 'Suite' Set Suite Variable ${${i}} &{d}[${i}] + ... ELSE IF '${RSPAMD_SCOPE}' == 'Test' Set Test Variable ${${i}} &{d}[${i}] + ... ELSE Fail 'RSPAMD_SCOPE must be Test or Suite' + END Generic Teardown [Arguments] @{ports} @@ -144,7 +146,8 @@ Run Nginx Run Rspamc [Arguments] @{args} - ${result} = Run Process ${RSPAMC} -t 60 --header Queue-ID\=${TEST NAME} @{args} env:LD_LIBRARY_PATH=${TESTDIR}/../../contrib/aho-corasick + ${result} = Run Process ${RSPAMC} -t 60 --header Queue-ID\=${TEST NAME} + ... @{args} env:LD_LIBRARY_PATH=${TESTDIR}/../../contrib/aho-corasick Log ${result.stdout} [Return] ${result} @@ -158,9 +161,10 @@ Run Rspamd ... ELSE Make Temporary Directory Set Directory Ownership ${tmpdir} ${RSPAMD_USER} ${RSPAMD_GROUP} ${template} = Get File ${CONFIG} - : FOR ${i} IN @{vargs} - \ ${newvalue} = Replace Variables ${${i}} - \ Set To Dictionary ${d} ${i}=${newvalue} + FOR ${i} IN @{vargs} + ${newvalue} = Replace Variables ${${i}} + Set To Dictionary ${d} ${i}=${newvalue} + END ${config} = Replace Variables ${template} ${config} = Replace Variables ${config} Log ${config} @@ -188,8 +192,10 @@ Simple Teardown Sync Fuzzy Storage [Arguments] @{vargs} ${len} = Get Length ${vargs} - ${result} = Run Keyword If $len == 0 Run Process ${RSPAMADM} control -s ${TMPDIR}/rspamd.sock fuzzy_sync - ... ELSE Run Process ${RSPAMADM} control -s @{vargs}[0]/rspamd.sock fuzzy_sync + ${result} = Run Keyword If $len == 0 Run Process ${RSPAMADM} control -s + ... ${TMPDIR}/rspamd.sock fuzzy_sync + ... ELSE Run Process ${RSPAMADM} control -s @{vargs}[0]/rspamd.sock + ... fuzzy_sync 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] -- cgit v1.2.3