commit ff00709: [Test] Add test cases for dynamic symbols

Vsevolod Stakhov vsevolod at rspamd.com
Sat Jun 10 17:14:03 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-06-10 18:07:03 +0100
URL: https://github.com/rspamd/rspamd/commit/ff0070983897a0fc2638fb526c6992619b68232a (HEAD -> master)

[Test] Add test cases for dynamic symbols

---
 test/functional/cases/001_merged/102_multimap.robot | 18 ++++++++++++++++++
 test/functional/configs/maps/dynamic_symbols.map    |  2 ++
 test/functional/configs/merged-override.conf        |  6 ++++++
 3 files changed, 26 insertions(+)

diff --git a/test/functional/cases/001_merged/102_multimap.robot b/test/functional/cases/001_merged/102_multimap.robot
index 99bc138ba..135f5ce34 100644
--- a/test/functional/cases/001_merged/102_multimap.robot
+++ b/test/functional/cases/001_merged/102_multimap.robot
@@ -416,3 +416,21 @@ MAP - EXTERNAL MISS
   Scan File  ${MESSAGE}  IP=127.0.0.1  Hostname=example.com.bg
   ...   Settings={symbols_enabled = [EXTERNAL_MULTIMAP]}
   Do Not Expect Symbol  EXTERNAL_MULTIMAP
+
+MAP - DYNAMIC SYMBOLS - SYM1
+  Scan File  ${MESSAGE}  IP=127.0.0.1  Hostname=foo
+  ...   Settings={symbols_enabled = [DYN_TEST1,DYN_TEST2,DYN_MULTIMAP]}
+  Expect Symbol  DYN_TEST1
+  Do Not Expect Symbol  DYN_TEST2
+
+MAP - DYNAMIC SYMBOLS - SYM2
+  Scan File  ${MESSAGE}  IP=127.0.0.1  Hostname=bar
+  ...   Settings={symbols_enabled = [DYN_TEST1,DYN_TEST2,DYN_MULTIMAP]}
+  Expect Symbol  DYN_TEST2
+  Do Not Expect Symbol  DYN_TEST1
+
+MAP - DYNAMIC SYMBOLS - MISS
+  Scan File  ${MESSAGE}  IP=127.0.0.1  Hostname=baz
+  ...   Settings={symbols_enabled = [DYN_TEST1,DYN_TEST2,DYN_MULTIMAP]}
+  Do Not Expect Symbol  DYN_TEST2
+  Do Not Expect Symbol  DYN_TEST1
diff --git a/test/functional/configs/maps/dynamic_symbols.map b/test/functional/configs/maps/dynamic_symbols.map
new file mode 100644
index 000000000..ec92c74af
--- /dev/null
+++ b/test/functional/configs/maps/dynamic_symbols.map
@@ -0,0 +1,2 @@
+foo DYN_TEST1:10:opt1,opt2
+bar DYN_TEST2:20:opt3,opt4
diff --git a/test/functional/configs/merged-override.conf b/test/functional/configs/merged-override.conf
index b589e7da9..74d9b441f 100644
--- a/test/functional/configs/merged-override.conf
+++ b/test/functional/configs/merged-override.conf
@@ -247,6 +247,12 @@ multimap {
         method = "query",
       }
   }
+
+  DYN_MULTIMAP {
+    type = "hostname";
+    map = "{= env.TESTDIR =}/configs/maps/dynamic_symbols.map";
+    dynamic_symbols = true;
+  }
 }
 
 rbl {


More information about the Commits mailing list