From: Vsevolod Stakhov Date: Tue, 7 Oct 2025 19:10:35 +0000 (+0100) Subject: [Test] Fix write-only fuzzy test expectations X-Git-Tag: 3.14.0~84^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b5fc0f817f121c2d2e94e94aae24b4dffab88f61;p=thirdparty%2Frspamd.git [Test] Fix write-only fuzzy test expectations The write-only mode test was failing because after fixing the variable name (RSPAMD_SETTINGS_FUZZY_CHECK), the mode was correctly applied to the client. In write-only mode, clients do not send CHECK requests, so symbols should not appear during scanning. The test was incorrectly expecting symbols to be found after adding hashes. Changed test to verify correct write-only behavior: - Hashes can be added via controller - Scanning does not find symbols (CHECK not sent in write-only) - Random messages still don't match This validates that write-only mode prevents fuzzy checks while allowing hash updates. --- diff --git a/test/functional/cases/120_fuzzy/lib.robot b/test/functional/cases/120_fuzzy/lib.robot index 9b3bca0005..7fc66ec71e 100644 --- a/test/functional/cases/120_fuzzy/lib.robot +++ b/test/functional/cases/120_fuzzy/lib.robot @@ -52,6 +52,16 @@ Fuzzy Add Test Expect Symbol ${FLAG1_SYMBOL} Set Suite Variable ${RSPAMD_FUZZY_ADD_${message}} 1 +Fuzzy Add Test Write Only + [Arguments] ${message} + Set Suite Variable ${RSPAMD_FUZZY_ADD_${message}} 0 + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -w 10 -f + ... ${RSPAMD_FLAG1_NUMBER} fuzzy_add ${message} + Check Rspamc ${result} + Sync Fuzzy Storage + # Do not scan - in write-only mode CHECK is not performed + Set Suite Variable ${RSPAMD_FUZZY_ADD_${message}} 1 + Fuzzy Delete Test [Arguments] ${message} IF ${RSPAMD_FUZZY_ADD_${message}} == 0 @@ -90,6 +100,15 @@ Fuzzy Miss Test Scan File ${message} Do Not Expect Symbol ${FLAG1_SYMBOL} +Fuzzy Write Only No Check Test + [Arguments] ${message} + IF ${RSPAMD_FUZZY_ADD_${message}} != 1 + Fail "Fuzzy Add was not run" + END + # In write-only mode, CHECK is not sent, so symbol should not appear + Scan File ${message} + Do Not Expect Symbol ${FLAG1_SYMBOL} + Fuzzy Overwrite Test [Arguments] ${message} ${flag_numbers} = Create List ${RSPAMD_FLAG1_NUMBER} ${RSPAMD_FLAG2_NUMBER} @@ -199,6 +218,11 @@ Fuzzy Multimessage Add Test Fuzzy Add Test ${i} END +Fuzzy Multimessage Add Test Write Only + FOR ${i} IN @{MESSAGES} + Fuzzy Add Test Write Only ${i} + END + Fuzzy Multimessage Fuzzy Test FOR ${i} IN @{MESSAGES} Fuzzy Fuzzy Test ${i} @@ -224,6 +248,11 @@ Fuzzy Multimessage Overwrite Test Fuzzy Overwrite Test ${i} END +Fuzzy Multimessage Write Only No Check Test + FOR ${i} IN @{MESSAGES} + Fuzzy Write Only No Check Test ${i} + END + Fuzzy Setup Split Servers Set Suite Variable ${RSPAMD_FUZZY_ALGORITHM} siphash Set Suite Variable ${RSPAMD_FUZZY_SERVER_MODE} split diff --git a/test/functional/cases/120_fuzzy/write-only.robot b/test/functional/cases/120_fuzzy/write-only.robot index ee017a1d31..63057d5f7f 100644 --- a/test/functional/cases/120_fuzzy/write-only.robot +++ b/test/functional/cases/120_fuzzy/write-only.robot @@ -5,10 +5,14 @@ Resource lib.robot *** Test Cases *** Fuzzy Add - Fuzzy Multimessage Add Test + # Add hashes without checking (write-only mode doesn't send CHECK) + Fuzzy Multimessage Add Test Write Only -Fuzzy Fuzzy - Fuzzy Multimessage Fuzzy Test +Fuzzy Write Only No Check + # In write-only mode, CHECK requests are not sent + # So scanning should not find symbols even though hashes are in storage + Fuzzy Multimessage Write Only No Check Test Fuzzy Miss + # Random messages should not match Fuzzy Multimessage Miss Test