]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Add tests for multimap received maps
authorAndrew Lewis <nerf@judo.za.org>
Mon, 13 Feb 2017 16:13:07 +0000 (18:13 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 13 Feb 2017 16:33:17 +0000 (18:33 +0200)
test/functional/cases/102_multimap.robot
test/functional/configs/maps/rcvd.list [new file with mode: 0644]
test/functional/configs/multimap.conf
test/functional/messages/received1.eml [new file with mode: 0644]
test/functional/messages/received2.eml [new file with mode: 0644]

index 89bafe750ebced0a51871b12cdb5dd7f8cb312d3..161c9055b2007e8e9d9fbc15467747a2d5e801c8 100644 (file)
@@ -11,6 +11,8 @@ ${MESSAGE}      ${TESTDIR}/messages/spam_message.eml
 ${UTF_MESSAGE}  ${TESTDIR}/messages/utf.eml
 ${REDIS_SCOPE}  Suite
 ${RSPAMD_SCOPE}  Suite
+${RCVD1}        ${TESTDIR}/messages/received1.eml
+${RCVD2}        ${TESTDIR}/messages/received2.eml
 ${URL1}         ${TESTDIR}/messages/url1.eml
 ${URL2}         ${TESTDIR}/messages/url2.eml
 ${URL3}         ${TESTDIR}/messages/url3.eml
@@ -254,6 +256,16 @@ MAP - REDIS - ASN FILTERED - MISS
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  -i  46.228.47.114
   Check Rspamc  ${result}  REDIS_ASN_FILTERED  inverse=1
 
+MAP - RECEIVED - IP MINMAX POS - ONE
+  ${result} =  Scan Message With Rspamc  ${RCVD1}
+  Check Rspamc  ${result}  RCVD_TEST_01
+  Check Rspamc  ${result}  RCVD_TEST_02  inverse=1
+
+MAP - RECEIVED - IP MINMAX POS - TWO
+  ${result} =  Scan Message With Rspamc  ${RCVD2}
+  Check Rspamc  ${result}  RCVD_TEST_02
+  Check Rspamc  ${result}  RCVD_TEST_01  inverse=1
+
 *** Keywords ***
 Multimap Setup
   ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/multimap.conf
diff --git a/test/functional/configs/maps/rcvd.list b/test/functional/configs/maps/rcvd.list
new file mode 100644 (file)
index 0000000..5c59711
--- /dev/null
@@ -0,0 +1 @@
+2a01:7c8:aab6:26d:5054:ff:fed1:1da2
index d28b8a8bffea7da19ad3d92bc6459447f6a99ede..538e21e7ba5a9bbf292a6346126e3194fd9276f3 100644 (file)
@@ -122,4 +122,14 @@ multimap {
     map = "redis://asn";
     filter = "regexp:/^([0-9]).*/";
   }
+  RCVD_TEST_01 {
+    type = "received";
+    max_pos = 1;
+    map = "${TESTDIR}/configs/maps/rcvd.list";
+  }
+  RCVD_TEST_02 {
+    type = "received";
+    min_pos = -2;
+    map = "${TESTDIR}/configs/maps/rcvd.list";
+  }
 }
diff --git a/test/functional/messages/received1.eml b/test/functional/messages/received1.eml
new file mode 100644 (file)
index 0000000..6cc5529
--- /dev/null
@@ -0,0 +1,16 @@
+Received: from server.chat-met-vreemden.nl (unknown [IPv6:2a01:7c8:aab6:26d:5054:ff:fed1:1da2])\r
+       (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\r
+       (Client did not present a certificate)\r
+       by mx1.freebsd.org (Postfix) with ESMTPS id CF0171862\r
+       for <test@example.com>; Mon,  6 Jul 2015 09:01:20 +0000 (UTC)\r
+       (envelope-from upwest201diana@outlook.com)\r
+Received: from ca-18-193-131.service.infuturo.it ([151.18.193.131] helo=User)\r
+       by server.chat-met-vreemden.nl with esmtpa (Exim 4.76)\r
+       (envelope-from <upwest201diana@outlook.com>)\r
+       id 1ZC1sl-0006b4-TU; Mon, 06 Jul 2015 10:36:08 +0200\r
+Received: apparently\r
+Received: or is it\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+\r
+Hello\r
diff --git a/test/functional/messages/received2.eml b/test/functional/messages/received2.eml
new file mode 100644 (file)
index 0000000..b5587e8
--- /dev/null
@@ -0,0 +1,16 @@
+Received: apparently\r
+Received: or is it\r
+Received: from server.chat-met-vreemden.nl (unknown [IPv6:2a01:7c8:aab6:26d:5054:ff:fed1:1da2])\r
+       (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\r
+       (Client did not present a certificate)\r
+       by mx1.freebsd.org (Postfix) with ESMTPS id CF0171862\r
+       for <test@example.com>; Mon,  6 Jul 2015 09:01:20 +0000 (UTC)\r
+       (envelope-from upwest201diana@outlook.com)\r
+Received: from ca-18-193-131.service.infuturo.it ([151.18.193.131] helo=User)\r
+       by server.chat-met-vreemden.nl with esmtpa (Exim 4.76)\r
+       (envelope-from <upwest201diana@outlook.com>)\r
+       id 1ZC1sl-0006b4-TU; Mon, 06 Jul 2015 10:36:08 +0200\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+\r
+Hello\r