]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Exercise rspamadm lua logger in functional tests 4728/head
authorAndrew Lewis <nerf@judo.za.org>
Wed, 6 Dec 2023 12:30:14 +0000 (14:30 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 6 Dec 2023 12:30:14 +0000 (14:30 +0200)
test/functional/cases/150_rspamadm.robot
test/functional/lua/rspamadm/test_batch.lua
test/functional/lua/rspamadm/test_verbose.lua [new file with mode: 0644]

index 879d4d7e8a6844868fcd689fb8b20d12bb07d65a..83229dd11d6c407d322907f1e388db1946567160 100644 (file)
@@ -34,7 +34,12 @@ Process message callback
 
 Lua batch mode
   ${result} =  Run Process  ${RSPAMADM}  lua  -b  ${RSPAMD_TESTDIR}/lua/rspamadm/test_batch.lua
-  Should Match Regexp  ${result.stderr}  ^$
+  Should Be Equal  ${result.stderr}  hello world
+  Should Match Regexp  ${result.stdout}  ^$
   Should Be Equal As Integers  ${result.rc}  0
-  Should Be Equal  ${result.stdout}  hello world
 
+Verbose mode
+  ${result} =  Run Process  ${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
index e75154b7c390fdc4aa85d86e0a191be255a00627..dd50c9db5f771450bd44e67307d49dad4bc3743b 100644 (file)
@@ -1 +1,4 @@
-print("hello world")
\ No newline at end of file
+local rspamd_logger = require "rspamd_logger"
+
+rspamd_logger.info(rspamd_config, "nope")
+rspamd_logger.err(rspamd_config, "hello world")
diff --git a/test/functional/lua/rspamadm/test_verbose.lua b/test/functional/lua/rspamadm/test_verbose.lua
new file mode 100644 (file)
index 0000000..4470c63
--- /dev/null
@@ -0,0 +1,3 @@
+local rspamd_logger = require "rspamd_logger"
+
+rspamd_logger.info(rspamd_config, "hello world")