Skip to content

Commit f1270a8

Browse files
authored
Adjust test runners to the number of tests to run (#2759)
This is fixing a minor annoyance when running single tests. With this change, the runtest script doesn't start more runners than the total number of tests to run. These are seen in the printouts like `[ready]: 68359`. Screenshot before: ``` $ ./runtest --single tests/unit/limits.tcl Cleanup: may take some time... OK Starting test server at port 21079 [ready]: 68359 Testing unit/limits [ready]: 68355 [ready]: 68362 [ready]: 68356 [ready]: 68361 [ready]: 68358 [ready]: 68364 [ready]: 68366 [ready]: 68367 [ready]: 68368 [ready]: 68357 [ready]: 68360 [ready]: 68363 [ready]: 68365 [ready]: 68369 [ready]: 68370 [ok]: Check if maxclients works refusing connections (906 ms) [1/1 done]: unit/limits (1 seconds) The End Execution time of different units: 1 seconds - unit/limits \o/ All tests passed without errors! Cleanup: may take some time... OK ``` Screenshot after: ``` $ ./runtest --single tests/unit/limits.tcl Cleanup: may take some time... OK Starting test server at port 21079 [ready]: 68439 Testing unit/limits [ok]: Check if maxclients works refusing connections (906 ms) [1/1 done]: unit/limits (1 seconds) The End Execution time of different units: 1 seconds - unit/limits \o/ All tests passed without errors! Cleanup: may take some time... OK ``` Signed-off-by: Viktor Söderqvist <[email protected]>
1 parent 746d9ec commit f1270a8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/test_helper.tcl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,11 @@ if {[llength $filtered_tests] < [llength $::all_tests]} {
907907
set ::all_tests $filtered_tests
908908
}
909909

910+
# Don't start more test runners than the total number of tests to run.
911+
if {$::numclients > [llength $filtered_tests] && $::total_loops == 1} {
912+
set ::numclients [llength $filtered_tests]
913+
}
914+
910915
proc attach_to_replication_stream_on_connection {conn} {
911916
r config set repl-ping-replica-period 3600
912917
if {$::tls} {

0 commit comments

Comments
 (0)