aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMikhail Galanin <mgalanin@mimecast.com>2018-08-24 09:20:48 +0100
committerMikhail Galanin <mgalanin@mimecast.com>2018-08-24 09:20:48 +0100
commit2d492871cd02521a86d1408e2946c16200e70439 (patch)
tree013dd76f9ae2be4451736b5a61cda07d46078549 /test
parent213ba86aaa6c1cf62210db1ce19213eeb6f6d5de (diff)
downloadrspamd-2d492871cd02521a86d1408e2946c16200e70439.tar.gz
rspamd-2d492871cd02521a86d1408e2946c16200e70439.zip
[Test] Use new routines in test, just for test (manual one) :)
Diffstat (limited to 'test')
-rw-r--r--test/functional/lua/http.lua55
1 files changed, 51 insertions, 4 deletions
diff --git a/test/functional/lua/http.lua b/test/functional/lua/http.lua
index 03c4ca6fc..44a6c6fd3 100644
--- a/test/functional/lua/http.lua
+++ b/test/functional/lua/http.lua
@@ -70,9 +70,56 @@ local function http_symbol(task)
end
end
+
+local function finish(task)
+ rspamd_logger.errx('function finish')
+ local err, response = rspamd_http.request({
+ url = 'http://site.resolveme:18080/timeout',
+ task = task,
+ method = 'get',
+ timeout = 1,
+ })
+ if err then
+ task:insert_result('HTTP_CORO_DNS_FINISH_ERROR', 1.0, err)
+ else
+ task:insert_result('HTTP_CORO_DNS_FINISH_' .. response.code, 1.0, response.content)
+ end
+end
+
+local function periodic(cfg, ev_base)
+ local err, response = rspamd_http.request({
+ url = 'http://site.resolveme:18080/request/periodic',
+ config = cfg,
+ })
+ if err then
+ rspamd_logger.errx('periodic err ' .. err)
+ else
+ rspamd_logger.errx('periodic success ' .. response.content)
+ end
+
+ return false
+end
+
rspamd_config:register_symbol({
- name = 'SIMPLE_TEST',
- score = 1.0,
- callback = http_symbol,
- no_squeeze = true
+name = 'SIMPLE_TEST',
+score = 1.0,
+callback = http_symbol,
+no_squeeze = true
})
+
+
+rspamd_config:register_finish_script(finish)
+
+rspamd_config:add_on_load(function(cfg, ev_base, worker)
+ local err, response = rspamd_http.request({
+ url = 'http://site.resolveme:18080/request/add_on_load',
+ config = cfg,
+ })
+ if err then
+ rspamd_logger.errx('add_on_load err ' .. err)
+ else
+ rspamd_logger.errx('add_on_load success ' .. response.content)
+ end
+
+ rspamd_config:add_periodic(ev_base, 0, periodic, false)
+end) \ No newline at end of file