From: Andrew Lewis Date: Fri, 22 Jul 2016 09:15:31 +0000 (+0100) Subject: [Test] Add test for legacy RSPAMC protocol X-Git-Tag: 1.3.0~12^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F742%2Fhead;p=thirdparty%2Frspamd.git [Test] Add test for legacy RSPAMC protocol --- diff --git a/test/functional/cases/general.robot b/test/functional/cases/general.robot index 5fb80520dc..8876ef9802 100644 --- a/test/functional/cases/general.robot +++ b/test/functional/cases/general.robot @@ -35,3 +35,8 @@ GTUBE - SPAMC ${result} = Spamc ${LOCAL_ADDR} ${PORT_NORMAL} ${GTUBE} Follow Rspamd Log Should Contain ${result} GTUBE + +GTUBE - RSPAMC + ${result} = Rspamc ${LOCAL_ADDR} ${PORT_NORMAL} ${GTUBE} + Follow Rspamd Log + Should Contain ${result} GTUBE diff --git a/test/functional/lib/rspamd.py b/test/functional/lib/rspamd.py index 56356e599f..ef7c6e29c1 100644 --- a/test/functional/lib/rspamd.py +++ b/test/functional/lib/rspamd.py @@ -41,6 +41,19 @@ def read_log_from_position(filename, offset): size = len(goo) return [goo, size+offset] +def rspamc(addr, port, filename): + mboxgoo = b"From MAILER-DAEMON Fri May 13 19:17:40 2016\r\n" + goo = open(filename, 'rb').read() + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((addr, port)) + s.send(b"CHECK RSPAMC/1.0\r\nContent-length: ") + s.send(str(len(goo+mboxgoo)).encode('utf-8')) + s.send(b"\r\n\r\n") + s.send(mboxgoo) + s.send(goo) + r = s.recv(2048) + return r.decode('utf-8') + def scan_file(addr, port, filename): return str(urlopen("http://%s:%s/symbols?file=%s" % (addr, port, filename)).read())