commit 0d434c6: [Test] Revert tests changes

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Mar 1 10:07:04 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-03-01 10:00:10 +0000
URL: https://github.com/rspamd/rspamd/commit/0d434c6ce319dc0a0362110059af8625900f0eb4 (HEAD -> master)

[Test] Revert tests changes

---
 test/functional/cases/220_http.robot     | 16 ++++++++--------
 test/functional/cases/230_tcp.robot      | 16 ++++++++++++++++
 test/functional/cases/231_tcp_down.robot |  2 +-
 test/functional/cases/240_redis.robot    |  1 +
 test/functional/lua/http.lua             |  6 +++---
 test/functional/lua/redis.lua            | 14 ++++++++++----
 test/functional/lua/tcp.lua              | 11 ++++++-----
 7 files changed, 45 insertions(+), 21 deletions(-)

diff --git a/test/functional/cases/220_http.robot b/test/functional/cases/220_http.robot
index 7166b2a56..b4292897e 100644
--- a/test/functional/cases/220_http.robot
+++ b/test/functional/cases/220_http.robot
@@ -15,25 +15,25 @@ ${RSPAMD_SCOPE}  Test
 
 *** Test Cases ***
 Simple HTTP request
-  Check url  /request  get  HTTP_DNS_200  HTTP_200  method_get  hello world
-  Check url  /request  post  HTTP_DNS_200  HTTP_200  method_post  hello post
+  Check url  /request  get  HTTP_DNS_200  HTTP_200  HTTP_CORO_DNS_200  HTTP_CORO_200  method_get  hello world  HTTP_CORO_200 (0.00)[hello world]
+  Check url  /request  post  HTTP_DNS_200  HTTP_200  HTTP_CORO_DNS_200  HTTP_CORO_200  method_post  hello post  HTTP_CORO_DNS_200 (0.00)[hello post]
 
 *** Test Cases ***
 HTTP request 403
-  Check url  /error_403  get  HTTP_DNS_403  HTTP_403  method_get
-  Check url  /error_403  post  HTTP_DNS_403  HTTP_403  method_post
+  Check url  /error_403  get  HTTP_DNS_403  HTTP_403  HTTP_CORO_DNS_403  HTTP_CORO_403  method_get
+  Check url  /error_403  post  HTTP_DNS_403  HTTP_403  HTTP_CORO_DNS_403  HTTP_CORO_403  method_post
 
 
 *** Test Cases ***
 HTTP timeout
-  Check url  /timeout  get  HTTP_ERROR  HTTP_ERROR  method_get  IO timeout
-  Check url  /timeout  post  HTTP_DNS_ERROR  HTTP_ERROR  method_post  IO timeout
+  Check url  /timeout  get  HTTP_ERROR  HTTP_ERROR  HTTP_CORO_DNS_ERROR  HTTP_CORO_ERROR  method_get  IO timeout
+  Check url  /timeout  post  HTTP_DNS_ERROR  HTTP_ERROR  HTTP_CORO_DNS_ERROR  HTTP_CORO_ERROR  method_post  IO timeout
 
 
 *** Test Cases ***
 HTTP empty response
-  Check url  /empty  get  HTTP_ERROR  HTTP_ERROR  method_get  IO read error: unexpected EOF
-  Check url  /empty  post  HTTP_DNS_ERROR  HTTP_ERROR  method_post  IO read error: unexpected EOF
+  Check url  /empty  get  HTTP_ERROR  HTTP_ERROR  HTTP_CORO_DNS_ERROR  HTTP_CORO_ERROR  method_get  IO read error: unexpected EOF
+  Check url  /empty  post  HTTP_DNS_ERROR  HTTP_ERROR  HTTP_CORO_DNS_ERROR  HTTP_CORO_ERROR  method_post  IO read error: unexpected EOF
 
 
 *** Keywords ***
diff --git a/test/functional/cases/230_tcp.robot b/test/functional/cases/230_tcp.robot
index b7828f84e..4d8b2fbd6 100644
--- a/test/functional/cases/230_tcp.robot
+++ b/test/functional/cases/230_tcp.robot
@@ -19,6 +19,22 @@ Simple TCP request
   Check Rspamc  ${result}  HTTP_ASYNC_RESPONSE
   Check Rspamc  ${result}  HTTP_ASYNC_RESPONSE_2
 
+
+Sync API TCP request
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}
+  Check Rspamc  ${result}  HTTP_SYNC_RESPONSE
+  Check Rspamc  ${result}  HTTP_SYNC_RESPONSE_2
+  Check Rspamc  ${result}  hello world
+  Check Rspamc  ${result}  hello post
+
+Sync API TCP get request
+  Check url  /request  get  HTTP_SYNC_EOF_get (0.00)[hello world]
+  Check url  /content-length  get  HTTP_SYNC_CONTENT_get (0.00)[hello world]
+
+Sync API TCP post request
+  Check url  /request  post  HTTP_SYNC_EOF_post (0.00)[hello post]
+  Check url  /content-length  post  HTTP_SYNC_CONTENT_post (0.00)[hello post]
+
 *** Keywords ***
 Lua Setup
   [Arguments]  ${LUA_SCRIPT}
diff --git a/test/functional/cases/231_tcp_down.robot b/test/functional/cases/231_tcp_down.robot
index 6131bc9fb..f852724ad 100644
--- a/test/functional/cases/231_tcp_down.robot
+++ b/test/functional/cases/231_tcp_down.robot
@@ -19,7 +19,7 @@ Sync API TCP get request when server is down
   [Documentation]  We don't create HTTP server here, that's why
   ...              all requests fail with "connection refused"
   Check url  /request  get  HTTP_ASYNC_RESPONSE (0.00)[Socket error detected: Connection refused]
-#Check url  /content-length  HTTP_SYNC_WRITE_ERROR (0.00)[Socket error detected: Connection refused]
+  Check url  /content-length  HTTP_SYNC_WRITE_ERROR (0.00)[Socket error detected: Connection refused]
 
 
 *** Keywords ***
diff --git a/test/functional/cases/240_redis.robot b/test/functional/cases/240_redis.robot
index 83a8f28d5..cf73f59ad 100644
--- a/test/functional/cases/240_redis.robot
+++ b/test/functional/cases/240_redis.robot
@@ -20,6 +20,7 @@ ${MESSAGE}      ${TESTDIR}/messages/spam_message.eml
 Redis client
   Redis SET  test_key  test value
   ${result} =  Scan Message With Rspamc  ${MESSAGE}
+  Check Rspamc  ${result}  REDIS (0.00)[hello from lua on redis]
   Check Rspamc  ${result}  REDIS_ASYNC (0.00)[test value]
   Check Rspamc  ${result}  REDIS_ASYNC201809 (0.00)[test value]
 
diff --git a/test/functional/lua/http.lua b/test/functional/lua/http.lua
index a433a9d93..1981c8734 100644
--- a/test/functional/lua/http.lua
+++ b/test/functional/lua/http.lua
@@ -43,7 +43,7 @@ local function http_symbol(task)
     callback = http_dns_callback,
     timeout = 1,
   })
---[[
+
   rspamd_logger.errx(task, 'rspamd_http.request[before]')
 
   local err, response = rspamd_http.request({
@@ -73,7 +73,6 @@ local function http_symbol(task)
   else
     task:insert_result('HTTP_CORO_DNS_ERROR', 1.0, err)
   end
-  --]]
 end
 
 
@@ -110,7 +109,8 @@ rspamd_config:register_symbol({
 name = 'SIMPLE_TEST',
 score = 1.0,
 callback = http_symbol,
-no_squeeze = true
+no_squeeze = true,
+flags = 'coro'
 })
 
 
diff --git a/test/functional/lua/redis.lua b/test/functional/lua/redis.lua
index 075660063..1a1eaf2b7 100644
--- a/test/functional/lua/redis.lua
+++ b/test/functional/lua/redis.lua
@@ -2,11 +2,17 @@
 -- Just a test for Redis API
 --]]
 
+local logger = require "rspamd_logger"
 local redis_lua = require "lua_redis"
 
 local redis_params
 local N = 'redis_test'
 
+local lua_script = [[
+local f = function() end
+return "hello from lua on redis"
+]]
+
 local function redis_simple_async_symbol(task)
   local function redis_cb(err, data)
     if err then
@@ -46,7 +52,7 @@ local function redis_simple_async_api201809(task)
   }
   redis_lua.request(redis_params, attrs, request)
 end
---[[
+
 local function redis_symbol(task)
 
   local attrs = {task = task}
@@ -81,7 +87,7 @@ local function redis_symbol(task)
   task:insert_result('REDIS', 1.0, data)
 
 end
---]]
+
 redis_params = rspamd_parse_redis_server(N)
 
 rspamd_config:register_symbol({
@@ -97,11 +103,11 @@ rspamd_config:register_symbol({
   callback = redis_simple_async_api201809,
   no_squeeze = true
 })
---[[
+
 rspamd_config:register_symbol({
   name = 'REDIS_TEST',
   score = 1.0,
   callback = redis_symbol,
-  no_squeeze = true
+  flags = 'coro',
 })
 -- ]]
diff --git a/test/functional/lua/tcp.lua b/test/functional/lua/tcp.lua
index 63c70683d..d032a049f 100644
--- a/test/functional/lua/tcp.lua
+++ b/test/functional/lua/tcp.lua
@@ -31,7 +31,7 @@ local function http_simple_tcp_async_symbol(task)
     port = 18080,
   })
 end
---[[
+
 local function http_simple_tcp_symbol(task)
   logger.errx(task, 'connect_sync, before')
 
@@ -171,25 +171,26 @@ local function http_tcp_symbol(task)
   end
   logger.errx(task, '(is_ok: %1) content [%2 bytes] %3', is_ok, content_length, content)
 end
---]]
+
 rspamd_config:register_symbol({
   name = 'SIMPLE_TCP_ASYNC_TEST',
   score = 1.0,
   callback = http_simple_tcp_async_symbol,
   no_squeeze = true
 })
---[[
 rspamd_config:register_symbol({
   name = 'SIMPLE_TCP_TEST',
   score = 1.0,
   callback = http_simple_tcp_symbol,
-  no_squeeze = true
+  no_squeeze = true,
+  flags = 'coro',
 })
 
 rspamd_config:register_symbol({
   name = 'HTTP_TCP_TEST',
   score = 1.0,
   callback = http_tcp_symbol,
-  no_squeeze = true
+  no_squeeze = true,
+  flags = 'coro',
 })
 -- ]]


More information about the Commits mailing list