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.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. Run Dummy Http
  37. Run Redis
  38. Rspamadm test Teardown
  39. ${http_pid} = Get File /tmp/dummy_http.pid
  40. Shutdown Process With Children ${http_pid}
  41. Remove file /tmp/dummy_http.pid
  42. Shutdown Process With Children ${REDIS_PID}
  43. Run Dummy Http
  44. [Arguments]
  45. ${result} = Start Process ${TESTDIR}/util/dummy_http.py
  46. Wait Until Created /tmp/dummy_http.pid
  47. Prepare temp directory
  48. [Arguments] ${CONFIG}
  49. ${template} = Get File ${CONFIG}
  50. ${tmpdir} = Make Temporary Directory
  51. ${config} = Replace Variables ${template}
  52. ${config} = Replace Variables ${config}
  53. Log ${config}
  54. Create File ${tmpdir}/rspamd.conf ${config}
  55. [Return] ${tmpdir}