File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed
Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ - Fixed a bug when server initialization didn't reset artifact handling,
6+ causing stale artifacts to persist after server restarts (gh-409 ).
57- Group and suite hooks must now be registered using the call-style
68 API. Use:
79
Original file line number Diff line number Diff line change @@ -327,6 +327,7 @@ function Server:initialize()
327327
328328 local prefix = fio .pathjoin (Server .vardir , ' artifacts' , self .rs_id or ' ' )
329329 self .artifacts = fio .pathjoin (prefix , self .id )
330+ self .artifacts_saved = false
330331
331332 self .log_file = fio .pathjoin (self .workdir , self .alias .. ' .log' )
332333end
@@ -585,12 +586,12 @@ function Server:stop()
585586 end
586587end
587588
588- --- Stop the server and save its artifacts if the test fails .
589+ --- Stop the server and save its artifacts.
589590-- This function should be used only at the end of the test (`after_test`,
590591-- `after_each`, `after_all` hooks) to terminate the server process.
591592-- Besides process termination, it saves the contents of the server
592593-- working directory to the `<vardir>/artifacts` directory for further
593- -- analysis if the test fails .
594+ -- analysis.
594595function Server :drop ()
595596 self :stop ()
596597 self :save_artifacts ()
Original file line number Diff line number Diff line change @@ -645,3 +645,28 @@ g.test_assertion_failure = function()
645645 server :connect_net_box ()
646646 helper .assert_failure (server .exec , server , function () t .assert (false ) end )
647647end
648+
649+ g .test_save_artifacts_after_restart_when_test_failed = function ()
650+ local s = Server :new ()
651+
652+ s :start ()
653+ s :exec (function ()
654+ require (' log' ).info (' before_restart_artifacts_marker' )
655+ end )
656+
657+ s :restart ()
658+ s :exec (function ()
659+ require (' log' ).info (' after_restart_artifacts_marker' )
660+ end )
661+
662+ s :drop ()
663+
664+ local log_path = fio .pathjoin (s .artifacts , s .alias .. ' .log' )
665+ local log_file = fio .open (log_path )
666+ local log_stat = log_file :stat ()
667+ local log_content = log_file :read (log_stat .size )
668+ log_file :close ()
669+
670+ t .assert_str_contains (log_content , ' before_restart_artifacts_marker' )
671+ t .assert_str_contains (log_content , ' after_restart_artifacts_marker' )
672+ end
You can’t perform that action at this time.
0 commit comments