]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Add test cases for dynamic symbols
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 10 Jun 2023 17:07:03 +0000 (18:07 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 10 Jun 2023 17:07:03 +0000 (18:07 +0100)
test/functional/cases/001_merged/102_multimap.robot
test/functional/configs/maps/dynamic_symbols.map [new file with mode: 0644]
test/functional/configs/merged-override.conf

index 99bc138ba00756b454982a65130f473e9b9d383d..135f5ce34cf3c9d41cdf1bf18d3bf64f999db3c9 100644 (file)
@@ -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 (file)
index 0000000..ec92c74
--- /dev/null
@@ -0,0 +1,2 @@
+foo DYN_TEST1:10:opt1,opt2
+bar DYN_TEST2:20:opt3,opt4
index b589e7da9e6487544c7b257f2318d0f90854d5ae..74d9b441fa1658b8fecfd6027f0529e7a4c023c5 100644 (file)
@@ -247,6 +247,12 @@ multimap {
         method = "query",
       }
   }
+
+  DYN_MULTIMAP {
+    type = "hostname";
+    map = "{= env.TESTDIR =}/configs/maps/dynamic_symbols.map";
+    dynamic_symbols = true;
+  }
 }
 
 rbl {