From cd6b3d558be0703b1a43f9fe58fd5f1ed7452829 Mon Sep 17 00:00:00 2001 From: yoav-steinberg Date: Thu, 11 Nov 2021 13:04:02 +0200 Subject: Archive external redis log in external tests (#9765) On test failure store the external redis server logs as CI artifacts so we can review them. Write test name to server log for external server tests. This is attempted and silently failed in case external server doesn't support it. Note that in non-external server mode we use a more robust method of writing to the log which doesn't depend on the server actually running/working. This isn't possible for externl servers and required for some complex tests which are skipped in external mode anyway. Cleanup: remove dup code. --- tests/support/test.tcl | 10 ++++++++-- tests/support/util.tcl | 8 -------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'tests/support') diff --git a/tests/support/test.tcl b/tests/support/test.tcl index 22f7926da..118300dbc 100644 --- a/tests/support/test.tcl +++ b/tests/support/test.tcl @@ -152,11 +152,17 @@ proc test {name code {okpattern undefined} {tags {}}} { set details {} lappend details "$name in $::curfile" - # set a cur_test global to be logged into new servers that are spown + # set a cur_test global to be logged into new servers that are spawn # and log the test name in all existing servers set prev_test $::cur_test set ::cur_test "$name in $::curfile" - if {!$::external} { + if {$::external} { + catch { + set r [redis [srv 0 host] [srv 0 port] 0 $::tls] + $r debug log "### Starting test $::cur_test" + $r close + } + } else { foreach srv $::servers { set stdout [dict get $srv stdout] set fd [open $stdout "a+"] diff --git a/tests/support/util.tcl b/tests/support/util.tcl index d6f8fc062..23684be3f 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -699,14 +699,6 @@ proc generate_fuzzy_traffic_on_key {key duration} { return $sent } -# write line to server log file -proc write_log_line {srv_idx msg} { - set logfile [srv $srv_idx stdout] - set fd [open $logfile "a+"] - puts $fd "### $msg" - close $fd -} - proc string2printable s { set res {} set has_special_chars false -- cgit v1.2.1