aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-02 17:05:17 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-02 17:05:17 +0100
commitf20d5669094f438509e84fb762149ddc96a5706c (patch)
tree68c7ac5b5bcb1c4f6cadaf86b70eac75d419afa0 /test/functional
parentc3b8ab4425a166cfc9fb85068532fc9eeb66a68d (diff)
downloadrspamd-f20d5669094f438509e84fb762149ddc96a5706c.tar.gz
rspamd-f20d5669094f438509e84fb762149ddc96a5706c.zip
Start functional tests.
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/configs/trivial.conf25
-rw-r--r--test/functional/messages/gtube.eml25
-rw-r--r--test/functional/test_helper.bash12
-rw-r--r--test/functional/tests.bats13
4 files changed, 75 insertions, 0 deletions
diff --git a/test/functional/configs/trivial.conf b/test/functional/configs/trivial.conf
new file mode 100644
index 000000000..0750d5834
--- /dev/null
+++ b/test/functional/configs/trivial.conf
@@ -0,0 +1,25 @@
+options = {
+ filters = ["spf", "dkim", "regexp"]
+ url_tld = "${CURDIR}/lua/unit/test_tld.dat"
+ dns = {
+ nameserver = "8.8.8.8"
+ }
+ pidfile = "/tmp/rspamd-bats.pid"
+}
+logging = {
+ type = "console",
+ level = "debug"
+}
+metric = {
+ name = "default",
+ actions = {
+ reject = 100500,
+ }
+ unknown_weight = 1
+}
+
+worker {
+ type = normal
+ bind_socket = localhost:56789
+ count = 1
+}
diff --git a/test/functional/messages/gtube.eml b/test/functional/messages/gtube.eml
new file mode 100644
index 000000000..cb7363b75
--- /dev/null
+++ b/test/functional/messages/gtube.eml
@@ -0,0 +1,25 @@
+Subject: Test spam mail (GTUBE)
+Message-ID: <GTUBE1.1010101@example.net>
+Date: Wed, 23 Jul 2003 23:30:00 +0200
+From: Sender <sender@example.net>
+To: Recipient <recipient@example.net>
+Precedence: junk
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Transfer-Encoding: 7bit
+
+This is the GTUBE, the
+ Generic
+ Test for
+ Unsolicited
+ Bulk
+ Email
+
+If your spam filter supports it, the GTUBE provides a test by which you
+can verify that the filter is installed correctly and is detecting incoming
+spam. You can send yourself a test mail containing the following string of
+characters (in upper case and with no white spaces and line breaks):
+
+XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
+
+You should send this test mail from an account outside of your network.
diff --git a/test/functional/test_helper.bash b/test/functional/test_helper.bash
new file mode 100644
index 000000000..6753c0de3
--- /dev/null
+++ b/test/functional/test_helper.bash
@@ -0,0 +1,12 @@
+function run_rspamd() {
+ RSPAMD_USER=${RSPAMD_USER:-"nobody"}
+ RSPAMD_GROUP=${RSPAMD_GROUP:-"nogroup"}
+ RSPAMD=${RSPAMD:-"../src/rspamd"}
+
+ ${RSPAMD} -c ${RSPAMD_CONFIG} -u ${RSPAMD_USER} -g ${RSPAMD_GROUP}
+}
+
+
+function teardown() {
+ pkill -TERM rspamd
+}
diff --git a/test/functional/tests.bats b/test/functional/tests.bats
new file mode 100644
index 000000000..d366a367b
--- /dev/null
+++ b/test/functional/tests.bats
@@ -0,0 +1,13 @@
+load test_helper
+
+RSPAMC="$BATS_TEST_DIRNAME/../../src/client/rspamc"
+
+@test "Test rspamd using gtube" {
+ export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/trivial.conf"
+ run_rspamd
+ run ${RSPAMC} -h localhost:56789 \
+ "$BATS_TEST_DIRNAME/messages/gtube.eml"
+ [ "$status" -eq 0 ]
+
+ echo $output | grep 'Action: reject'
+} \ No newline at end of file