commit b7c397e: [Test] More test fixes

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Aug 12 15:56:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-08-12 16:50:37 +0100
URL: https://github.com/rspamd/rspamd/commit/b7c397e222b24041108bd972b267aff3c93d581a

[Test] More test fixes

---
 test/functional/cases/230_tcp.robot  |  4 ++--
 test/functional/lua/tcp.lua          | 10 ++++++----
 test/functional/util/dummy_killer.py |  2 +-
 test/functional/util/dummy_ssl.py    |  8 +++++---
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/test/functional/cases/230_tcp.robot b/test/functional/cases/230_tcp.robot
index deb141ebe..b5801dba0 100644
--- a/test/functional/cases/230_tcp.robot
+++ b/test/functional/cases/230_tcp.robot
@@ -21,8 +21,8 @@ Simple TCP request
 
 SSL TCP request
   ${result} =  Scan Message With Rspamc  ${MESSAGE}
-  Check Rspamc  ${result}  TCP_SSL_RESPONSE (0.00)[test]
-  Check Rspamc  ${result}  TCP_SSL_RESPONSE_2 (0.00)[test2]
+  Check Rspamc  ${result}  TCP_SSL_RESPONSE (0.00)[hello]
+  Check Rspamc  ${result}  TCP_SSL_RESPONSE_2 (0.00)[hello]
 
 SSL Large TCP request
   ${result} =  Scan Message With Rspamc  ${MESSAGE}
diff --git a/test/functional/lua/tcp.lua b/test/functional/lua/tcp.lua
index dc26b2935..0d2ff0727 100644
--- a/test/functional/lua/tcp.lua
+++ b/test/functional/lua/tcp.lua
@@ -72,20 +72,20 @@ local function http_large_tcp_ssl_symbol(task)
   end
   local function ssl_read_cb(err, rep, conn)
     logger.errx(task, 'ssl_large_read_cb: got reply: %s, error: %s, conn: %s', rep, err, conn)
-    conn:add_write(ssl_read_post_cb, data)
+    conn:add_write(ssl_read_post_cb, 'foo\n')
     task:insert_result('TCP_SSL_LARGE', 1.0)
   end
 
   if task:get_queue_id() == 'SSL Large TCP request' then
     logger.errx(task, 'ssl_large_tcp_symbol: begin')
-    for i = 1,10 do
+    for i = 1,2 do
       local st = {}
-      for j=1,60000 do
+      for j=1,300000 do
         st[j] = 't'
       end
-      st[#st + 1] = '\n'
       data[i] = table.concat(st)
     end
+    data[#data + 1] = '\n'
 
     rspamd_tcp:request({
       task = task,
@@ -94,8 +94,10 @@ local function http_large_tcp_ssl_symbol(task)
       data = data,
       read = true,
       ssl = true,
+      stop_pattern = '\n',
       ssl_noverify = true,
       port = 14433,
+      timeout = 20,
     })
   else
     logger.errx(task, 'ssl_large_tcp_symbol: skip')
diff --git a/test/functional/util/dummy_killer.py b/test/functional/util/dummy_killer.py
index 85b3d01ba..6b3181608 100644
--- a/test/functional/util/dummy_killer.py
+++ b/test/functional/util/dummy_killer.py
@@ -14,7 +14,7 @@ def setup_killer(server, method = None):
 
     signal.signal(signal.SIGALRM, alarm_handler)
     signal.signal(signal.SIGTERM, alarm_handler)
-    signal.alarm(30)
+    signal.alarm(120)
 
 
 def write_pid(path):
diff --git a/test/functional/util/dummy_ssl.py b/test/functional/util/dummy_ssl.py
index e150b151a..725f8052a 100755
--- a/test/functional/util/dummy_ssl.py
+++ b/test/functional/util/dummy_ssl.py
@@ -17,14 +17,14 @@ PID = "/tmp/dummy_ssl.pid"
 class SSLTCPHandler(SocketServer.BaseRequestHandler):
     def handle(self):
         time.sleep(0.5)
-        data = self.request.recv(16384)
+        data = self.request.recv(6000000)
         while data:
             print "{} wrote:".format(self.client_address[0])
             print data
             time.sleep(0.1)
-            self.request.sendall(data)
+            self.request.sendall('hello\n')
             time.sleep(0.1)
-            data = self.request.recv(16384)
+            data = self.request.recv(6000000)
 
 class SSL_TCP_Server(SocketServer.TCPServer):
     def __init__(self,
@@ -59,6 +59,8 @@ class SSL_TCP_Server(SocketServer.TCPServer):
             print "Interrupt"
         except socket.error as e:
             print "Socket closed {}".format(e)
+        finally:
+            self.server_close()
 
     def stop(self):
         self.keep_running = False


More information about the Commits mailing list