commit 29fb22a: [Test] rspamadm tests: override DBDIR

Andrew Lewis nerf at judo.za.org
Mon Jul 29 17:53:11 UTC 2024


Author: Andrew Lewis
Date: 2024-02-29 19:15:55 +0200
URL: https://github.com/rspamd/rspamd/commit/29fb22ad7503ea5792cf92c5f7dffad1cafc9127 (refs/pull/4847/head)

[Test] rspamadm tests: override DBDIR

---
 test/functional/cases/150_rspamadm.robot | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/test/functional/cases/150_rspamadm.robot b/test/functional/cases/150_rspamadm.robot
index ef3db9880..ba9bef5bd 100644
--- a/test/functional/cases/150_rspamadm.robot
+++ b/test/functional/cases/150_rspamadm.robot
@@ -1,18 +1,18 @@
 *** Settings ***
+Suite Setup     Rspamadm Setup
+Suite Teardown  Rspamadm Teardown
 Library         Process
 Library         ../lib/rspamd.py
 
-Suite Teardown    Terminate All Processes    kill=True
-
 *** Test Cases ***
 Config Test
-  ${result} =  Run Process  ${RSPAMADM}  configtest
+  ${result} =  Rspamadm  configtest
   Should Match Regexp  ${result.stderr}  ^$
   Should Match Regexp  ${result.stdout}  ^syntax OK$
   Should Be Equal As Integers  ${result.rc}  0
 
 Config Help
-  ${result} =  Run Process  ${RSPAMADM}  confighelp
+  ${result} =  Rspamadm  confighelp
   Should Match Regexp  ${result.stderr}  ^$
   Should Be Equal As Integers  ${result.rc}  0
 
@@ -20,26 +20,46 @@ Simple interpreter
   ${handle} =  Start Process  ${RSPAMADM}  lua  stdin=PIPE
   ${result} =  Write to stdin  ${handle}  1+1
   Should Be Equal As Strings  ${result}  2\n
+  Wait For Process  ${handle}
 
 Simple interpreter, two results
   ${handle} =  Start Process  ${RSPAMADM}  lua  stdin=PIPE
   ${result} =  Write to stdin  ${handle}  1+1, 2 * 5
   Should Be Equal  ${result}  2\n10\n
+  Wait For Process  ${handle}
 
 Process message callback
   ${handle} =  Start Process  ${RSPAMADM}  lua  stdin=PIPE
   ${result} =  Write to stdin  ${handle}  .load ${RSPAMD_TESTDIR}/lua/rspamadm/test_message_callback.lua\n.message message_callback ${RSPAMD_TESTDIR}/messages/empty_part.eml
   Should Contain  ${result}  n parts = 2
   Should Contain  ${result}  1\n2\n4\n6
+  Wait For Process  ${handle}
 
 Lua batch mode
-  ${result} =  Run Process  ${RSPAMADM}  lua  -b  ${RSPAMD_TESTDIR}/lua/rspamadm/test_batch.lua
+  ${result} =  Rspamadm  lua  -b  ${RSPAMD_TESTDIR}/lua/rspamadm/test_batch.lua
   Should Be Equal  ${result.stderr}  hello world
   Should Match Regexp  ${result.stdout}  ^$
   Should Be Equal As Integers  ${result.rc}  0
 
 Verbose mode
-  ${result} =  Run Process  ${RSPAMADM}  -v  lua  ${RSPAMD_TESTDIR}/lua/rspamadm/test_verbose.lua
+  ${result} =  Rspamadm  -v  lua  ${RSPAMD_TESTDIR}/lua/rspamadm/test_verbose.lua
   Should Match Regexp  ${result.stderr}  ^$
   Should Match Regexp  ${result.stdout}  hello world\n
   Should Be Equal As Integers  ${result.rc}  0
+
+*** Keywords ***
+Rspamadm Setup
+  ${RSPAMADM_TMPDIR} =  Make Temporary Directory
+  Set Suite Variable  ${RSPAMADM_TMPDIR}
+
+Rspamadm Teardown
+  Cleanup Temporary Directory  ${RSPAMADM_TMPDIR}
+
+Rspamadm
+  [Arguments]  @{args}
+  ${result} =  Run Process  ${RSPAMADM}
+  ...  --var\=TMPDIR\=${RSPAMADM_TMPDIR}
+  ...  --var\=DBDIR\=${RSPAMADM_TMPDIR}
+  ...  --var\=LOCAL_CONFDIR\=/nonexistent
+  ...  @{args}
+  [Return]  ${result}


More information about the Commits mailing list