aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/lib/rspamd.robot
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2021-05-05 00:42:11 +0200
committerAndrew Lewis <nerf@judo.za.org>2021-05-05 00:42:11 +0200
commit5569dbacfc83c42e68e8668d065707023212c6eb (patch)
tree498574bfcd327d206ce4fae74ad7cb69220c8095 /test/functional/lib/rspamd.robot
parenta84cecac6bef1211cf8ab245d997b6ac64b6686a (diff)
downloadrspamd-5569dbacfc83c42e68e8668d065707023212c6eb.tar.gz
rspamd-5569dbacfc83c42e68e8668d065707023212c6eb.zip
[Test] Cleanup
- Use consistent naming for setup/teardown - Remove some unused files - Sort & align variables
Diffstat (limited to 'test/functional/lib/rspamd.robot')
-rw-r--r--test/functional/lib/rspamd.robot119
1 files changed, 55 insertions, 64 deletions
diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot
index 8f090881a..865245e62 100644
--- a/test/functional/lib/rspamd.robot
+++ b/test/functional/lib/rspamd.robot
@@ -56,10 +56,6 @@ Do Not Expect Symbols
... msg=Symbol ${symbol} was not expected to be found in result
END
-Generic Setup
- [Arguments] &{kw}
- New Setup &{kw}
-
Expect Action
[Arguments] ${action}
Should Be Equal ${SCAN_RESULT}[action] ${action}
@@ -156,42 +152,10 @@ Export Scoped Variables
... ELSE Fail message="Don't know what to do with scope: ${scope}"
END
-Generic Teardown
- # Robot Framework 4.0
- #Run Keyword If '${CONTROLLER_ERRORS}' == 'True' Run Keyword And Warn On Failure Check Controller Errors
- Run Keyword If '${CONTROLLER_ERRORS}' == 'True' Check Controller Errors
- Shutdown Process With Children ${RSPAMD_PID}
- Save Run Results ${RSPAMD_TMPDIR} rspamd.conf rspamd.log redis.log clickhouse-config.xml
- Log does not contain segfault record
- Collect Lua Coverage
- Cleanup Temporary Directory ${RSPAMD_TMPDIR}
-
- # Possibly deal with Redis
- ${redis_tmpdir} = Get Variable Value ${REDIS_TMPDIR}
- Run Keyword If '${redis_tmpdir}' != 'None' Cleanup Temporary Directory ${REDIS_TMPDIR}
- ${redis_pid} = Get Variable Value ${REDIS_PID}
- Run Keyword If '${redis_pid}' == 'None' Return From Keyword
- Shutdown Process With Children ${redis_pid}
-
Log does not contain segfault record
${log} = Get File ${RSPAMD_TMPDIR}/rspamd.log encoding_errors=ignore
Should not contain ${log} Segmentation fault: msg=Segmentation fault detected
-New Setup
- [Arguments] &{kw}
-
- # Create and chown temporary directory
- ${RSPAMD_TMPDIR} = Make Temporary Directory
- Set Directory Ownership ${RSPAMD_TMPDIR} ${RSPAMD_USER} ${RSPAMD_GROUP}
-
- # Export ${RSPAMD_TMPDIR} to appropriate scope according to ${RSPAMD_SCOPE}
- Export Scoped Variables ${RSPAMD_SCOPE} RSPAMD_TMPDIR=${RSPAMD_TMPDIR}
-
- New Run Rspamd
-
-Normal Teardown
- Generic Teardown
-
Redis HSET
[Arguments] ${hash} ${key} ${value}
${result} = Run Process redis-cli -h ${RSPAMD_REDIS_ADDR} -p ${RSPAMD_REDIS_PORT}
@@ -208,6 +172,39 @@ Redis SET
Log ${result.stdout}
Should Be Equal As Integers ${result.rc} 0
+Redis Teardown
+ ${redis_pid} = Get Variable Value ${REDIS_PID}
+ Shutdown Process With Children ${redis_pid}
+ Cleanup Temporary Directory ${REDIS_TMPDIR}
+
+Rspamd Setup
+ # Create and chown temporary directory
+ ${RSPAMD_TMPDIR} = Make Temporary Directory
+ Set Directory Ownership ${RSPAMD_TMPDIR} ${RSPAMD_USER} ${RSPAMD_GROUP}
+
+ # Export ${RSPAMD_TMPDIR} to appropriate scope according to ${RSPAMD_SCOPE}
+ Export Scoped Variables ${RSPAMD_SCOPE} RSPAMD_TMPDIR=${RSPAMD_TMPDIR}
+
+ Run Rspamd
+
+Rspamd Redis Setup
+ Run Redis
+ Rspamd Setup
+
+Rspamd Teardown
+ # Robot Framework 4.0
+ #Run Keyword If '${CONTROLLER_ERRORS}' == 'True' Run Keyword And Warn On Failure Check Controller Errors
+ Run Keyword If '${CONTROLLER_ERRORS}' == 'True' Check Controller Errors
+ Shutdown Process With Children ${RSPAMD_PID}
+ Save Run Results ${RSPAMD_TMPDIR} rspamd.conf rspamd.log redis.log clickhouse-config.xml
+ Log does not contain segfault record
+ Collect Lua Coverage
+ Cleanup Temporary Directory ${RSPAMD_TMPDIR}
+
+Rspamd Redis Teardown
+ Rspamd Teardown
+ Redis Teardown
+
Run Redis
${RSPAMD_TMPDIR} = Make Temporary Directory
${template} = Get File ${RSPAMD_TESTDIR}/configs/redis-server.conf
@@ -226,32 +223,6 @@ Run Redis
Log ${redis_log}
Run Rspamd
- New Run Rspamd
-
-Run Nginx
- ${template} = Get File ${RSPAMD_TESTDIR}/configs/nginx.conf
- ${config} = Replace Variables ${template}
- Create File ${RSPAMD_TMPDIR}/nginx.conf ${config}
- Log ${config}
- ${result} = Run Process nginx -c ${RSPAMD_TMPDIR}/nginx.conf
- Run Keyword If ${result.rc} != 0 Log ${result.stderr}
- Should Be Equal As Integers ${result.rc} 0
- Wait Until Keyword Succeeds 10x 1 sec Check Pidfile ${RSPAMD_TMPDIR}/nginx.pid timeout=0.5s
- Wait Until Keyword Succeeds 5x 1 sec TCP Connect ${NGINX_ADDR} ${NGINX_PORT}
- ${NGINX_PID} = Get File ${RSPAMD_TMPDIR}/nginx.pid
- Run Keyword If '${NGINX_SCOPE}' == 'Test' Set Test Variable ${NGINX_PID}
- ... ELSE IF '${NGINX_SCOPE}' == 'Suite' Set Suite Variable ${NGINX_PID}
- ${nginx_log} = Get File ${RSPAMD_TMPDIR}/nginx.log
- Log ${nginx_log}
-
-Run Rspamc
- [Arguments] @{args}
- ${result} = Run Process ${RSPAMC} -t 60 --header Queue-ID\=${TEST NAME}
- ... @{args} env:LD_LIBRARY_PATH=${RSPAMD_TESTDIR}/../../contrib/aho-corasick
- Log ${result.stdout}
- [Return] ${result}
-
-New Run Rspamd
Export Rspamd Variables To Environment
# Dump templated config or errors to log
@@ -284,8 +255,28 @@ New Run Rspamd
${RSPAMD_PID} = Get File ${RSPAMD_TMPDIR}/rspamd.pid
Export Scoped Variables ${RSPAMD_SCOPE} RSPAMD_PID=${RSPAMD_PID}
-Simple Teardown
- Generic Teardown
+Run Nginx
+ ${template} = Get File ${RSPAMD_TESTDIR}/configs/nginx.conf
+ ${config} = Replace Variables ${template}
+ Create File ${RSPAMD_TMPDIR}/nginx.conf ${config}
+ Log ${config}
+ ${result} = Run Process nginx -c ${RSPAMD_TMPDIR}/nginx.conf
+ Run Keyword If ${result.rc} != 0 Log ${result.stderr}
+ Should Be Equal As Integers ${result.rc} 0
+ Wait Until Keyword Succeeds 10x 1 sec Check Pidfile ${RSPAMD_TMPDIR}/nginx.pid timeout=0.5s
+ Wait Until Keyword Succeeds 5x 1 sec TCP Connect ${NGINX_ADDR} ${NGINX_PORT}
+ ${NGINX_PID} = Get File ${RSPAMD_TMPDIR}/nginx.pid
+ Run Keyword If '${NGINX_SCOPE}' == 'Test' Set Test Variable ${NGINX_PID}
+ ... ELSE IF '${NGINX_SCOPE}' == 'Suite' Set Suite Variable ${NGINX_PID}
+ ${nginx_log} = Get File ${RSPAMD_TMPDIR}/nginx.log
+ Log ${nginx_log}
+
+Run Rspamc
+ [Arguments] @{args}
+ ${result} = Run Process ${RSPAMC} -t 60 --header Queue-ID\=${TEST NAME}
+ ... @{args} env:LD_LIBRARY_PATH=${RSPAMD_TESTDIR}/../../contrib/aho-corasick
+ Log ${result.stdout}
+ [Return] ${result}
Scan File By Reference
[Arguments] ${filename} &{headers}