You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151_rspamadm_async.robot 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. *** Settings ***
  2. Test Setup Rspamadm test Setup
  3. Test Teardown Rspamadm test Teardown
  4. Library Process
  5. Library ${TESTDIR}/lib/rspamd.py
  6. Resource ${TESTDIR}/lib/rspamd.robot
  7. Variables ${TESTDIR}/lib/vars.py
  8. Suite Teardown Terminate All Processes kill=True
  9. *** Variables ***
  10. ${REDIS_SCOPE} Test
  11. ${CONFIG} ${TESTDIR}/configs/plugins.conf
  12. ${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
  13. ${PLUGIN_CONFIG}
  14. *** Test Cases ***
  15. Tcp client
  16. ${result} = Run Process ${RSPAMADM} lua -b ${TESTDIR}/lua/rspamadm/test_tcp_client.lua
  17. Should Match Regexp ${result.stderr} ^$
  18. Should Be Equal As Integers ${result.rc} 0
  19. Should Be Equal ${result.stdout} hello post
  20. Redis client
  21. ${result} = Run Process ${RSPAMADM} lua -b ${TESTDIR}/lua/rspamadm/test_redis_client.lua
  22. Should Match Regexp ${result.stderr} ^$
  23. Should Be Equal As Integers ${result.rc} 0
  24. Should Be Equal ${result.stdout} true\thello from lua on redis
  25. DNS client
  26. ${tmpdir} = Prepare temp directory ${CONFIG}
  27. Set test variable ${tmpdir}
  28. ${result} = Run Process ${RSPAMADM} --var\=CONFDIR\=${tmpdir} lua -b ${TESTDIR}/lua/rspamadm/test_dns_client.lua
  29. Log ${result.stdout}
  30. Log ${result.stderr}
  31. Should Be Equal As Integers ${result.rc} 0
  32. Should Be Equal ${result.stdout} true\tk=ed25519; p=yi50DjK5O9pqbFpNHklsv9lqaS0ArSYu02qp1S0DW1Y=
  33. Cleanup Temporary Directory ${tmpdir}
  34. *** Keywords ***
  35. Rspamadm test Setup
  36. ${tmpdir} = Make Temporary Directory
  37. Set Suite Variable ${TMPDIR} ${tmpdir}
  38. Run Dummy Http
  39. Run Redis
  40. Rspamadm test Teardown
  41. ${http_pid} = Get File /tmp/dummy_http.pid
  42. Shutdown Process With Children ${http_pid}
  43. Remove file /tmp/dummy_http.pid
  44. Shutdown Process With Children ${REDIS_PID}
  45. Run Dummy Http
  46. [Arguments]
  47. ${result} = Start Process ${TESTDIR}/util/dummy_http.py
  48. Wait Until Created /tmp/dummy_http.pid
  49. Prepare temp directory
  50. [Arguments] ${CONFIG}
  51. ${template} = Get File ${CONFIG}
  52. ${tmpdir} = Make Temporary Directory
  53. ${config} = Replace Variables ${template}
  54. ${config} = Replace Variables ${config}
  55. Log ${config}
  56. Create File ${tmpdir}/rspamd.conf ${config}
  57. [Return] ${tmpdir}