]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Test] Fix write-only fuzzy test expectations
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 7 Oct 2025 19:10:35 +0000 (20:10 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 7 Oct 2025 19:18:21 +0000 (20:18 +0100)
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.

test/functional/cases/120_fuzzy/lib.robot
test/functional/cases/120_fuzzy/write-only.robot

index 9b3bca000568287aa8ce8393efea8ad09444250d..7fc66ec71e9351bfb7c3d7f42422af3c07abc1ff 100644 (file)
@@ -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
index ee017a1d3162911874997773c9e8795f73ec5f17..63057d5f7f10ecb9cc5fc543550f616d62085b15 100644 (file)
@@ -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