]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Test] 411_logging: read per-suite rspamd output, not global .last
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 25 May 2026 20:00:43 +0000 (21:00 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 25 May 2026 20:00:43 +0000 (21:00 +0100)
save_run_results writes each rspamd's logs to two destinations: the
stable per-suite/per-test directory under robot-save/, and a global
robot-save/<file>.last "convenience" copy of the most recent run.

The three 411_logging tests asserted on the .last copies. Under
pabot another worker can teardown -- and overwrite the .last files
-- between this suite's Rspamd Teardown saving them and the
assertion reading them, so the assertion ends up running against a
different suite's rspamd output and matching the wrong format.

Switch to the per-suite paths
(robot-save/${SUITE_NAME}/rspamd.stderr for the console suites,
robot-save/${SUITE_NAME}/${TEST_NAME}/rspamd.log for the JSON file
test). Those paths aren't shared across pabot workers.

Local: three back-to-back parallel runs of the 411_logging
directory pass 3/3 each time.

test/functional/cases/411_logging/000_console/000_systemd_logger.robot
test/functional/cases/411_logging/000_console/001_timestamps.robot
test/functional/cases/411_logging/001_file/000_json.robot

index 88178461bb1b3d077e309ad852bd03dedf8612fb..0cd24bf131dece38eb9a6f5ff9f2e47a5a4f516e 100644 (file)
@@ -20,5 +20,7 @@ EMPTY TEST
 Systemd Teardown
   Touch  ${RSPAMD_TMPDIR}/rspamd.log
   Rspamd Teardown
-  ${log} =  Get File  ${EXECDIR}/robot-save/rspamd.stderr.last
+  # See sibling 001_timestamps.robot for why .last is unsafe under
+  # parallel pabot -- read the per-suite save instead.
+  ${log} =  Get File  ${EXECDIR}/robot-save/${SUITE_NAME}/rspamd.stderr
   Should Match Regexp  ${log}  \\n\\(main\\) lua; lua_cfg_transform\\.lua:\\d+: overriding actions from the legacy metric settings\\n
index bd8e2c349393066a451e2ad4ed46c540a2389a38..12160b033e1e890f2dfa42f3cd969f3b88a431af 100644 (file)
@@ -20,5 +20,9 @@ EMPTY TEST
 Console Timestamps Teardown
   Touch  ${RSPAMD_TMPDIR}/rspamd.log
   Rspamd Teardown
-  ${log} =  Get File  ${EXECDIR}/robot-save/rspamd.stderr.last
+  # robot-save/rspamd.stderr.last is the cross-suite "last run" copy
+  # of whatever rspamd.stderr was last torn down; under pabot another
+  # worker can overwrite it between Rspamd Teardown saving it and us
+  # reading it. The per-suite save_run_results destination is stable.
+  ${log} =  Get File  ${EXECDIR}/robot-save/${SUITE_NAME}/rspamd.stderr
   Should Match Regexp  ${log}  \\n\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}  #\\d+\\(main\\) lua; lua_cfg_transform\\.lua:\\d+: overriding actions from the legacy metric settings\\n
index a2f04e85c7edbb422364b2403ee9a542bdd4641a..0e6f00441059a3bf4f85148fd82952c05eff345e 100644 (file)
@@ -14,4 +14,7 @@ ${RSPAMD_SCOPE}                   Test
 *** Test Cases ***
 JSON LOGS
   Rspamd Teardown
-  Check JSON Log  ${EXECDIR}/robot-save/rspamd.log.last
+  # robot-save/rspamd.log.last is the global "last run" file and can
+  # be overwritten by another pabot worker's teardown between us
+  # writing it and reading it. Read the per-suite/per-test copy.
+  Check JSON Log  ${EXECDIR}/robot-save/${SUITE_NAME}/${TEST_NAME}/rspamd.log