*** Test Cases ***
Train
Sleep 2s Wait for redis mess
- FOR ${INDEX} IN RANGE 0 10
- Scan File ${MESSAGE} Settings={symbols_enabled = ["SPAM_SYMBOL"]}
- Expect Symbol SPAM_SYMBOL
- Scan File ${MESSAGE} Settings={symbols_enabled = ["HAM_SYMBOL"]}
- Expect Symbol HAM_SYMBOL
+ FOR ${INDEX} IN RANGE 1 11
+ Scan File ${MESSAGE} Settings={symbols_enabled = ["SPAM_SYMBOL${INDEX}"]}
+ Expect Symbol SPAM_SYMBOL${INDEX}
+ Scan File ${MESSAGE} Settings={symbols_enabled = ["HAM_SYMBOL${INDEX}"]}
+ Expect Symbol HAM_SYMBOL${INDEX}
END
Check Neural HAM
Sleep 2s Wait for neural to be loaded
- Scan File ${MESSAGE} Settings={symbols_enabled = ["HAM_SYMBOL"];groups_enabled=["neural"];symbols_disabled = ["NEURAL_LEARN"]}
+ Scan File ${MESSAGE} Settings={symbols_enabled = ["HAM_SYMBOL1","HAM_SYMBOL2","HAM_SYMBOL5"];groups_enabled=["neural"];symbols_disabled = ["NEURAL_LEARN"]}
Expect Symbol NEURAL_HAM_SHORT
Do Not Expect Symbol NEURAL_SPAM_SHORT
- Expect Symbol NEURAL_HAM_SHORT_PCA
- Do Not Expect Symbol NEURAL_SPAM_SHORT_PCA
+ #Expect Symbol NEURAL_HAM_SHORT_PCA
+ #Do Not Expect Symbol NEURAL_SPAM_SHORT_PCA
Check Neural SPAM
- Scan File ${MESSAGE} Settings={symbols_enabled = ["SPAM_SYMBOL"];groups_enabled=["neural"];symbols_disabled = ["NEURAL_LEARN"]}
+ Scan File ${MESSAGE} Settings={symbols_enabled = ["SPAM_SYMBOL2","SPAM_SYMBOL4","SPAM_SYMBOL6","SPAM_SYMBOL8"];groups_enabled=["neural"];symbols_disabled = ["NEURAL_LEARN"]}
Expect Symbol NEURAL_SPAM_SHORT
Do Not Expect Symbol NEURAL_HAM_SHORT
- Expect Symbol NEURAL_SPAM_SHORT_PCA
- Do Not Expect Symbol NEURAL_HAM_SHORT_PCA
+ #Expect Symbol NEURAL_SPAM_SHORT_PCA
+ #Do Not Expect Symbol NEURAL_HAM_SHORT_PCA
Train INVERSE
- FOR ${INDEX} IN RANGE 0 10
- Scan File ${MESSAGE} Settings={symbols_enabled = ["SPAM_SYMBOL"]; SPAM_SYMBOL = -5;}
- Expect Symbol SPAM_SYMBOL
- Scan File ${MESSAGE} Settings={symbols_enabled = ["HAM_SYMBOL"]; HAM_SYMBOL = 5;}
- Expect Symbol HAM_SYMBOL
+ FOR ${INDEX} IN RANGE 1 11
+ Scan File ${MESSAGE} Settings={symbols_enabled = ["SPAM_SYMBOL${INDEX}"]; SPAM_SYMBOL${INDEX} = -5;}
+ Expect Symbol SPAM_SYMBOL${INDEX}
+ Scan File ${MESSAGE} Settings={symbols_enabled = ["HAM_SYMBOL${INDEX}"]; HAM_SYMBOL${INDEX} = 5;}
+ Expect Symbol HAM_SYMBOL${INDEX}
END
Check Neural HAM INVERSE
Sleep 2s Wait for neural to be loaded
- Scan File ${MESSAGE} Settings={symbols_enabled = ["HAM_SYMBOL"];groups_enabled=["neural"]}
+ Scan File ${MESSAGE} Settings={symbols_enabled = ["HAM_SYMBOL1","HAM_SYMBOL2","HAM_SYMBOL5"];groups_enabled=["neural"]}
Expect Symbol NEURAL_SPAM_SHORT
- Expect Symbol NEURAL_SPAM_SHORT_PCA
+ #Expect Symbol NEURAL_SPAM_SHORT_PCA
Do Not Expect Symbol NEURAL_HAM_SHORT
- Do Not Expect Symbol NEURAL_HAM_SHORT_PCA
+ #Do Not Expect Symbol NEURAL_HAM_SHORT_PCA
Check Neural SPAM INVERSE
- Scan File ${MESSAGE} Settings={symbols_enabled = ["SPAM_SYMBOL"];groups_enabled=["neural"]}
+ Scan File ${MESSAGE} Settings={symbols_enabled = ["SPAM_SYMBOL2","SPAM_SYMBOL4","SPAM_SYMBOL6","SPAM_SYMBOL8"];groups_enabled=["neural"]}
Expect Symbol NEURAL_HAM_SHORT
- Expect Symbol NEURAL_HAM_SHORT_PCA
+ #Expect Symbol NEURAL_HAM_SHORT_PCA
Do Not Expect Symbol NEURAL_SPAM_SHORT
- Do Not Expect Symbol NEURAL_SPAM_SHORT_PCA
+ #Do Not Expect Symbol NEURAL_SPAM_SHORT_PCA
local logger = require "rspamd_logger"
-rspamd_config:register_symbol({
- name = 'SPAM_SYMBOL',
- score = 5.0,
- callback = function()
- return true, 'Fires always'
- end
-})
+for i = 1,10 do
+ rspamd_config:register_symbol({
+ name = 'SPAM_SYMBOL'..tostring(i),
+ score = 5.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+ })
+ rspamd_config:register_symbol({
+ name = 'HAM_SYMBOL'..tostring(i),
+ score = -3.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+ })
+end
+
-rspamd_config:register_symbol({
- name = 'HAM_SYMBOL',
- score = -3.0,
- callback = function()
- return true, 'Fires always'
- end
-})
rspamd_config:register_symbol({
name = 'NEUTRAL_SYMBOL',