summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-02-13 18:13:07 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-02-13 18:33:17 +0200
commitb031412b168dd53c26948bc559d7b47ed679c06b (patch)
treef544526ba103ce8469c60091d2c88c4ec1f634ff /test/functional
parent140fa526f13846bf4fdd2302d70fe5bd4e6f19c9 (diff)
downloadrspamd-b031412b168dd53c26948bc559d7b47ed679c06b.tar.gz
rspamd-b031412b168dd53c26948bc559d7b47ed679c06b.zip
[Test] Add tests for multimap received maps
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/cases/102_multimap.robot12
-rw-r--r--test/functional/configs/maps/rcvd.list1
-rw-r--r--test/functional/configs/multimap.conf10
-rw-r--r--test/functional/messages/received1.eml16
-rw-r--r--test/functional/messages/received2.eml16
5 files changed, 55 insertions, 0 deletions
diff --git a/test/functional/cases/102_multimap.robot b/test/functional/cases/102_multimap.robot
index 89bafe750..161c9055b 100644
--- a/test/functional/cases/102_multimap.robot
+++ b/test/functional/cases/102_multimap.robot
@@ -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
index 000000000..5c5971100
--- /dev/null
+++ b/test/functional/configs/maps/rcvd.list
@@ -0,0 +1 @@
+2a01:7c8:aab6:26d:5054:ff:fed1:1da2
diff --git a/test/functional/configs/multimap.conf b/test/functional/configs/multimap.conf
index d28b8a8bf..538e21e7b 100644
--- a/test/functional/configs/multimap.conf
+++ b/test/functional/configs/multimap.conf
@@ -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
index 000000000..6cc552934
--- /dev/null
+++ b/test/functional/messages/received1.eml
@@ -0,0 +1,16 @@
+Received: from server.chat-met-vreemden.nl (unknown [IPv6:2a01:7c8:aab6:26d:5054:ff:fed1:1da2])
+ (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
+ (Client did not present a certificate)
+ by mx1.freebsd.org (Postfix) with ESMTPS id CF0171862
+ for <test@example.com>; Mon, 6 Jul 2015 09:01:20 +0000 (UTC)
+ (envelope-from upwest201diana@outlook.com)
+Received: from ca-18-193-131.service.infuturo.it ([151.18.193.131] helo=User)
+ by server.chat-met-vreemden.nl with esmtpa (Exim 4.76)
+ (envelope-from <upwest201diana@outlook.com>)
+ id 1ZC1sl-0006b4-TU; Mon, 06 Jul 2015 10:36:08 +0200
+Received: apparently
+Received: or is it
+MIME-Version: 1.0
+Content-Type: text/plain
+
+Hello
diff --git a/test/functional/messages/received2.eml b/test/functional/messages/received2.eml
new file mode 100644
index 000000000..b5587e89d
--- /dev/null
+++ b/test/functional/messages/received2.eml
@@ -0,0 +1,16 @@
+Received: apparently
+Received: or is it
+Received: from server.chat-met-vreemden.nl (unknown [IPv6:2a01:7c8:aab6:26d:5054:ff:fed1:1da2])
+ (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
+ (Client did not present a certificate)
+ by mx1.freebsd.org (Postfix) with ESMTPS id CF0171862
+ for <test@example.com>; Mon, 6 Jul 2015 09:01:20 +0000 (UTC)
+ (envelope-from upwest201diana@outlook.com)
+Received: from ca-18-193-131.service.infuturo.it ([151.18.193.131] helo=User)
+ by server.chat-met-vreemden.nl with esmtpa (Exim 4.76)
+ (envelope-from <upwest201diana@outlook.com>)
+ id 1ZC1sl-0006b4-TU; Mon, 06 Jul 2015 10:36:08 +0200
+MIME-Version: 1.0
+Content-Type: text/plain
+
+Hello