]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Add combined maps tests
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 20 May 2019 17:00:52 +0000 (18:00 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 20 May 2019 17:00:52 +0000 (18:00 +0100)
test/functional/cases/102_multimap.robot
test/functional/configs/multimap.conf

index 5c0dce7816541b3bf062cbeb5e8da0136f0c0cfa..594faf0b6e7381f61c2cd6904a23d4df89711ee5 100644 (file)
@@ -59,6 +59,26 @@ MAP - FROM
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --from  user@example.com
   Check Rspamc  ${result}  FROM_MAP
 
+MAP - COMBINED IP MASK FROM
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -i  10.1.0.10  --from  user@example.com
+  Check Rspamc  ${result}  COMBINED_MAP_AND
+  Check Rspamc  ${result}  COMBINED_MAP_OR
+
+MAP - COMBINED IP MASK ONLY
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -i  10.1.0.10
+  Check Rspamc  ${result}  COMBINED_MAP_AND  inverse=1
+  Check Rspamc  ${result}  COMBINED_MAP_OR
+
+MAP - COMBINED FROM ONLY
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --from  user@example.com
+  Check Rspamc  ${result}  COMBINED_MAP_AND  inverse=1
+  Check Rspamc  ${result}  COMBINED_MAP_OR
+
+MAP - COMBINED MISS
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -i  11.1.0.10  --from  user@other.com
+  Check Rspamc  ${result}  COMBINED_MAP_AND  inverse=1
+  Check Rspamc  ${result}  COMBINED_MAP_OR  inverse=1
+
 MAP - FROM MISS
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --from  user@other.com
   Check Rspamc  ${result}  FROM_MAP  inverse=1
index 77326f26c0e9d29b94feab7486dea2a030a43c97..f003ec96eadd20bd335942ddb5406076b7a04fc9 100644 (file)
@@ -157,4 +157,34 @@ multimap {
     map = "${TESTDIR}/configs/maps/rcvd2.list";
     flags = ["authenticated", "ssl"];
   }
+  COMBINED_MAP_AND {
+    type = "combined";
+    rules {
+      ip = {
+        type = "radix";
+        map = "${TESTDIR}/configs/maps/ip.list";
+        selector = "ip";
+      }
+      from {
+        map = "${TESTDIR}/configs/maps/domains.list";
+        selector = "from:domain";
+      }
+    }
+    expression = "from & ip"
+  }
+  COMBINED_MAP_OR {
+    type = "combined";
+    rules {
+      ip = {
+        type = "radix";
+        map = "${TESTDIR}/configs/maps/ip.list";
+        selector = "ip";
+      }
+      from {
+        map = "${TESTDIR}/configs/maps/domains.list";
+        selector = "from:domain";
+      }
+    }
+    expression = "from || ip"
+  }
 }