commit fa772ca: [Test] Add combined maps tests

Vsevolod Stakhov vsevolod at highsecure.ru
Mon May 20 17:07:12 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-05-20 18:00:52 +0100
URL: https://github.com/rspamd/rspamd/commit/fa772caba9f33d86faa4fc6bca17db7145417752 (HEAD -> master)

[Test] Add combined maps tests

---
 test/functional/cases/102_multimap.robot | 20 ++++++++++++++++++++
 test/functional/configs/multimap.conf    | 30 ++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/test/functional/cases/102_multimap.robot b/test/functional/cases/102_multimap.robot
index 5c0dce781..594faf0b6 100644
--- a/test/functional/cases/102_multimap.robot
+++ b/test/functional/cases/102_multimap.robot
@@ -59,6 +59,26 @@ MAP - FROM
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --from  user at 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 at 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 at 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 at 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 at other.com
   Check Rspamc  ${result}  FROM_MAP  inverse=1
diff --git a/test/functional/configs/multimap.conf b/test/functional/configs/multimap.conf
index 77326f26c..f003ec96e 100644
--- a/test/functional/configs/multimap.conf
+++ b/test/functional/configs/multimap.conf
@@ -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"
+  }
 }


More information about the Commits mailing list