*** Settings ***
-Test Setup Servers Setup
-Test Teardown Servers Teardown
+Suite Setup Servers Setup
+Suite Teardown Servers Teardown
Library Process
Library ${TESTDIR}/lib/rspamd.py
Resource ${TESTDIR}/lib/rspamd.robot
${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
${CONFIG} ${TESTDIR}/configs/lua_test.conf
${MESSAGE} ${TESTDIR}/messages/spam_message.eml
-${RSPAMD_SCOPE} Test
+${RSPAMD_SCOPE} Suite
*** Test Cases ***
Simple TCP request
Check Rspamc ${result} TCP_SSL_RESPONSE (0.00)[test]
Check Rspamc ${result} TCP_SSL_RESPONSE_2 (0.00)[test2]
+SSL Large TCP request
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} TCP_SSL_LARGE (0.00)
+ Check Rspamc ${result} TCP_SSL_LARGE_2 (0.00)
+
Sync API TCP request
${result} = Scan Message With Rspamc ${MESSAGE}
Check Rspamc ${result} HTTP_SYNC_RESPONSE
})
end
+local function http_large_tcp_ssl_symbol(task)
+ local data = {}
+
+ local function ssl_get_cb(err, rep, conn)
+ logger.errx(task, 'ssl_get_cb: got reply: %s, error: %s, conn: %s', rep, err, conn)
+ task:insert_result('TCP_SSL_LARGE_2', 1.0)
+ end
+ local function ssl_read_post_cb(err, conn)
+ logger.errx(task, 'ssl_large_read_post_cb: write done: error: %s, conn: %s', err, conn)
+ conn:add_read(ssl_get_cb)
+ 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)
+ 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,10000000 do
+ data[i] = 'test\n'
+ end
+
+ rspamd_tcp:request({
+ task = task,
+ callback = ssl_read_cb,
+ host = '127.0.0.1',
+ data = data,
+ read = true,
+ ssl = true,
+ ssl_noverify = true,
+ port = 14433,
+ })
+ else
+ logger.errx(task, 'ssl_large_tcp_symbol: skip')
+ end
+end
+
local function http_simple_tcp_symbol(task)
logger.errx(task, 'connect_sync, before')
callback = http_simple_tcp_ssl_symbol,
no_squeeze = true
})
+rspamd_config:register_symbol({
+ name = 'LARGE_TCP_ASYNC_SSL_TEST',
+ score = 1.0,
+ callback = http_large_tcp_ssl_symbol,
+ no_squeeze = true
+})
rspamd_config:register_symbol({
name = 'SIMPLE_TCP_TEST',
score = 1.0,