diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-02 18:54:16 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-02 18:54:16 +0100 |
commit | 8d586a8cc112d54ebbe7c39d8c6c5f3b25369b72 (patch) | |
tree | d36126e363038b14e7a258492c9e98855700835e /test | |
parent | f52ea5e83fba08d5755506a6987ca3bb9ee0ab53 (diff) | |
download | rspamd-8d586a8cc112d54ebbe7c39d8c6c5f3b25369b72.tar.gz rspamd-8d586a8cc112d54ebbe7c39d8c6c5f3b25369b72.zip |
Add streamline HTTP test (failing for now).
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/cases/http_streamline.pl | 35 | ||||
-rw-r--r-- | test/functional/test_helper.bash | 2 | ||||
-rw-r--r-- | test/functional/tests.bats | 9 |
3 files changed, 45 insertions, 1 deletions
diff --git a/test/functional/cases/http_streamline.pl b/test/functional/cases/http_streamline.pl new file mode 100644 index 000000000..e5afc5aff --- /dev/null +++ b/test/functional/cases/http_streamline.pl @@ -0,0 +1,35 @@ +#!/usr/bin/env perl + +use warnings; +use strict; + +use Socket; + +my $host = "127.0.0.1"; +my $port = 56789; +my $input = shift; + +open(INPUT, "< $input") or die "Can't open input file $input\n"; + +socket(SOCKET,PF_INET,SOCK_STREAM,(getprotobyname('tcp'))[2]) + or die "Can't create a socket $!\n"; +connect(SOCKET, pack_sockaddr_in($port, inet_aton($host))) + or die "Can't connect to port $port! \n"; + +print SOCKET "POST /symbols HTTP/1.0\r\n\r\n"; + +while (my $line = <INPUT>) { + print SOCKET $line; +} + +SOCKET->autoflush(1); + +shutdown(SOCKET, 1); + +close(INPUT); + +while (my $line = <SOCKET>) { + print $line; +} + +close(SOCKET); diff --git a/test/functional/test_helper.bash b/test/functional/test_helper.bash index 6753c0de3..bccacf057 100644 --- a/test/functional/test_helper.bash +++ b/test/functional/test_helper.bash @@ -1,7 +1,7 @@ function run_rspamd() { RSPAMD_USER=${RSPAMD_USER:-"nobody"} RSPAMD_GROUP=${RSPAMD_GROUP:-"nogroup"} - RSPAMD=${RSPAMD:-"../src/rspamd"} + RSPAMD=${RSPAMD:-"$BATS_TEST_DIRNAME/../../src/rspamd"} ${RSPAMD} -c ${RSPAMD_CONFIG} -u ${RSPAMD_USER} -g ${RSPAMD_GROUP} } diff --git a/test/functional/tests.bats b/test/functional/tests.bats index d366a367b..73811f2d5 100644 --- a/test/functional/tests.bats +++ b/test/functional/tests.bats @@ -10,4 +10,13 @@ RSPAMC="$BATS_TEST_DIRNAME/../../src/client/rspamc" [ "$status" -eq 0 ] echo $output | grep 'Action: reject' +} + +@test "Test rspamd streamlined gtube" { + export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/trivial.conf" + run_rspamd + run perl $BATS_TEST_DIRNAME/cases/http_streamline.pl "$BATS_TEST_DIRNAME/messages/gtube.eml" + [ "$status" -eq 0 ] + + echo $output | grep 'Action: reject' }
\ No newline at end of file |