summaryrefslogtreecommitdiff
path: root/tests/support
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2023-04-12 09:19:21 +0300
committerGitHub <noreply@github.com>2023-04-12 09:19:21 +0300
commit997fa41e99271cc5c3a79e9bf8a1332b3d9ab0c2 (patch)
treee9518b5a84c42b73ba39b735bc4d11010adc3d70 /tests/support
parent45b8eea19f3e2491dec669f0745e513a4c9d7329 (diff)
downloadredis-997fa41e99271cc5c3a79e9bf8a1332b3d9ab0c2.tar.gz
Attempt to solve MacOS CI issues in GH Actions (#12013)
The MacOS CI in github actions often hangs without any logs. GH argues that it's due to resource utilization, either running out of disk space, memory, or CPU starvation, and thus the runner is terminated. This PR contains multiple attempts to resolve this: 1. introducing pause_process instead of SIGSTOP, which waits for the process to stop before resuming the test, possibly resolving race conditions in some tests, this was a suspect since there was one test that could result in an infinite loop in that case, in practice this didn't help, but still a good idea to keep. 2. disable the `save` config in many tests that don't need it, specifically ones that use heavy writes and could create large files. 3. change the `populate` proc to use short pipeline rather than an infinite one. 4. use `--clients 1` in the macos CI so that we don't risk running multiple resource demanding tests in parallel. 5. enable `--verbose` to be repeated to elevate verbosity and print more info to stdout when a test or a server starts.
Diffstat (limited to 'tests/support')
-rw-r--r--tests/support/server.tcl3
-rw-r--r--tests/support/test.tcl9
-rw-r--r--tests/support/util.tcl37
3 files changed, 41 insertions, 8 deletions
diff --git a/tests/support/server.tcl b/tests/support/server.tcl
index 4c596290d..9a3733b61 100644
--- a/tests/support/server.tcl
+++ b/tests/support/server.tcl
@@ -537,6 +537,9 @@ proc start_server {options {code undefined}} {
set fd [open $stdout "a+"]
puts $fd "### Starting server for test $::cur_test"
close $fd
+ if {$::verbose > 1} {
+ puts "### Starting server $stdout for test - $::cur_test"
+ }
}
# We may have a stdout left over from the previous tests, so we need
diff --git a/tests/support/test.tcl b/tests/support/test.tcl
index 68180bea4..b7cd38b38 100644
--- a/tests/support/test.tcl
+++ b/tests/support/test.tcl
@@ -168,7 +168,9 @@ proc test {name code {okpattern undefined} {tags {}}} {
send_data_packet $::test_server_fd skip $name
return
}
-
+ if {$::verbose > 1} {
+ puts "starting test $name"
+ }
# abort if only_tests was set but test name is not included
if {[llength $::only_tests] > 0 && ![search_pattern_list $name $::only_tests]} {
incr ::num_skipped
@@ -200,11 +202,16 @@ proc test {name code {okpattern undefined} {tags {}}} {
$r close
}
} else {
+ set servers {}
foreach srv $::servers {
set stdout [dict get $srv stdout]
set fd [open $stdout "a+"]
puts $fd "### Starting test $::cur_test"
close $fd
+ lappend servers $stdout
+ }
+ if {$::verbose > 1} {
+ puts "### Starting test $::cur_test - with servers: $servers"
}
}
diff --git a/tests/support/util.tcl b/tests/support/util.tcl
index 236fad314..c98e7801b 100644
--- a/tests/support/util.tcl
+++ b/tests/support/util.tcl
@@ -602,15 +602,24 @@ proc stop_bg_complex_data {handle} {
# Write num keys with the given key prefix and value size (in bytes). If idx is
# given, it's the index (AKA level) used with the srv procedure and it specifies
# to which Redis instance to write the keys.
-proc populate {num {prefix key:} {size 3} {idx 0}} {
- set rd [redis_deferring_client $idx]
- for {set j 0} {$j < $num} {incr j} {
- $rd set $prefix$j [string repeat A $size]
+proc populate {num {prefix key:} {size 3} {idx 0} {prints false}} {
+ r $idx deferred 1
+ if {$num > 16} {set pipeline 16} else {set pipeline $num}
+ set val [string repeat A $size]
+ for {set j 0} {$j < $pipeline} {incr j} {
+ r $idx set $prefix$j $val
+ if {$prints} {puts $j}
}
- for {set j 0} {$j < $num} {incr j} {
- $rd read
+ for {} {$j < $num} {incr j} {
+ r $idx set $prefix$j $val
+ r $idx read
+ if {$prints} {puts $j}
}
- $rd close
+ for {set j 0} {$j < $pipeline} {incr j} {
+ r $idx read
+ if {$prints} {puts $j}
+ }
+ r $idx deferred 0
}
proc get_child_pid {idx} {
@@ -636,6 +645,20 @@ proc process_is_alive pid {
}
}
+proc pause_process pid {
+ exec kill -SIGSTOP $pid
+ wait_for_condition 50 100 {
+ [string match {*T*} [lindex [exec ps j $pid] 16]]
+ } else {
+ puts [exec ps j $pid]
+ fail "process didn't stop"
+ }
+}
+
+proc resume_process pid {
+ exec kill -SIGCONT $pid
+}
+
proc cmdrstat {cmd r} {
if {[regexp "\r\ncmdstat_$cmd:(.*?)\r\n" [$r info commandstats] _ value]} {
set _ $value