*** Variables ***
${REDIS_SCOPE} Test
-
+${CONFIG} ${TESTDIR}/configs/plugins.conf
+${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
+${PLUGIN_CONFIG}
*** Test Cases ***
Tcp client
Should Be Equal As Integers ${result.rc} 0
Should Be Equal ${result.stdout} true\thello from lua on redis
+DNS client
+ ${tmpdir} = Prepare temp directory ${CONFIG}
+ Set test variable ${tmpdir}
+ ${result} = Run Process ${RSPAMADM} --var\=CONFDIR\=${tmpdir} lua -b ${TESTDIR}/lua/rspamadm/test_dns_client.lua
+ Should Be Equal As Integers ${result.rc} 0
+ Should Be Equal ${result.stdout} true\tk=ed25519; p=yi50DjK5O9pqbFpNHklsv9lqaS0ArSYu02qp1S0DW1Y=
+ Cleanup Temporary Directory ${tmpdir}
+
*** Keywords ***
Rspamadm test Setup
[Arguments]
${result} = Start Process ${TESTDIR}/util/dummy_http.py
Wait Until Created /tmp/dummy_http.pid
+
+Prepare temp directory
+ [Arguments] ${CONFIG}
+ ${template} = Get File ${CONFIG}
+ ${tmpdir} = Make Temporary Directory
+ ${config} = Replace Variables ${template}
+ ${config} = Replace Variables ${config}
+ Log ${config}
+ Create File ${tmpdir}/rspamd.conf ${config}
+ [Return] ${tmpdir}
\ No newline at end of file
--- /dev/null
+local rspamd_dns = require "rspamd_dns"
+local logger = require "rspamd_logger"
+
+local _r,err = rspamd_config:load_ucl('/Users/mgalanin/build/robot-save/rspamd.conf.last')
+
+if not _r then
+ rspamd_logger.errx('cannot parse %s: %s', opts['config'], err)
+ os.exit(1)
+end
+
+_r,err = rspamd_config:parse_rcl({'logging', 'worker'})
+if not _r then
+ rspamd_logger.errx('cannot process %s: %s', opts['config'], err)
+ os.exit(1)
+end
+
+rspamd_config:init_subsystem('dns', rspamadm_ev_base)
+
+
+local is_ok, results = rspamd_dns.request({
+ config = rspamd_config,
+ session = rspamadm_session,
+
+ type = 'txt',
+ name = 'test._domainkey.example.com',
+ -- name = '_dmarc.google.com',
+ })
+
+print(is_ok, results[1])