From 843a13e88f3544e936ead06a9d05af28eeefd5a1 Mon Sep 17 00:00:00 2001 From: Yossi Gottlieb Date: Thu, 22 Oct 2020 11:10:53 +0300 Subject: [PATCH] Add a --no-latency tests flag. (#7939) Useful for running tests on systems which may be way slower than usual. --- .github/workflows/daily.yml | 2 +- tests/integration/replication.tcl | 4 ++-- tests/test_helper.tcl | 4 ++++ tests/unit/latency-monitor.tcl | 10 +++++++--- tests/unit/memefficiency.tcl | 16 ++++++++++++---- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 1ccd99805..d78252026 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -200,7 +200,7 @@ jobs: run: make - name: test run: | - ./runtest --accurate --verbose + ./runtest --accurate --verbose --no-latency - name: module api test run: ./runtest-moduleapi --verbose - name: sentinel tests diff --git a/tests/integration/replication.tcl b/tests/integration/replication.tcl index 06414dd8a..f7f8d241b 100644 --- a/tests/integration/replication.tcl +++ b/tests/integration/replication.tcl @@ -655,11 +655,11 @@ start_server {tags {"repl"}} { puts "master utime: $master_utime" puts "master stime: $master_stime" } - if {$all_drop == "all" || $all_drop == "slow"} { + if {!$::no_latency && ($all_drop == "all" || $all_drop == "slow")} { assert {$master_utime < 70} assert {$master_stime < 70} } - if {$all_drop == "none" || $all_drop == "fast"} { + if {!$::no_latency && ($all_drop == "none" || $all_drop == "fast")} { assert {$master_utime < 15} assert {$master_stime < 15} } diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index b60adb881..37af46947 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -88,6 +88,7 @@ set ::quiet 0 set ::denytags {} set ::skiptests {} set ::skipunits {} +set ::no_latency 0 set ::allowtags {} set ::only_tests {} set ::single_tests {} @@ -540,6 +541,7 @@ proc print_help_screen {} { "--skipfile Name of a file containing test names that should be skipped (one per line)." "--skiptest Name of a file containing test names that should be skipped (one per line)." "--dont-clean Don't delete redis log files after the run." + "--no-latency Skip latency measurements and validation by some tests." "--stop Blocks once the first test fails." "--loop Execute the specified set of tests forever." "--wait-server Wait after server is started (so that you can attach a debugger)." @@ -641,6 +643,8 @@ for {set j 0} {$j < [llength $argv]} {incr j} { set ::durable 1 } elseif {$opt eq {--dont-clean}} { set ::dont_clean 1 + } elseif {$opt eq {--no-latency}} { + set ::no_latency 1 } elseif {$opt eq {--wait-server}} { set ::wait_server 1 } elseif {$opt eq {--stop}} { diff --git a/tests/unit/latency-monitor.tcl b/tests/unit/latency-monitor.tcl index 18b9ecebb..9ef0c6154 100644 --- a/tests/unit/latency-monitor.tcl +++ b/tests/unit/latency-monitor.tcl @@ -17,7 +17,9 @@ start_server {tags {"latency-monitor"}} { set max 450 foreach event [r latency history command] { lassign $event time latency - assert {$latency >= $min && $latency <= $max} + if {!$::no_latency} { + assert {$latency >= $min && $latency <= $max} + } incr min 100 incr max 100 set last_time $time ; # Used in the next test @@ -28,8 +30,10 @@ start_server {tags {"latency-monitor"}} { foreach event [r latency latest] { lassign $event eventname time latency max assert {$eventname eq "command"} - assert {$max >= 450 & $max <= 650} - assert {$time == $last_time} + if {!$::no_latency} { + assert {$max >= 450 & $max <= 650} + assert {$time == $last_time} + } break } } diff --git a/tests/unit/memefficiency.tcl b/tests/unit/memefficiency.tcl index fe4e44d3e..a81d33d9b 100644 --- a/tests/unit/memefficiency.tcl +++ b/tests/unit/memefficiency.tcl @@ -105,7 +105,9 @@ start_server {tags {"defrag"} overrides {appendonly yes auto-aof-rewrite-percent assert {$frag < 1.1} # due to high fragmentation, 100hz, and active-defrag-cycle-max set to 75, # we expect max latency to be not much higher than 7.5ms but due to rare slowness threshold is set higher - assert {$max_latency <= 30} + if {!$::no_latency} { + assert {$max_latency <= 30} + } } # verify the data isn't corrupted or changed set newdigest [r debug digest] @@ -148,7 +150,9 @@ start_server {tags {"defrag"} overrides {appendonly yes auto-aof-rewrite-percent assert {$frag < 1.4} # since the AOF contains simple (fast) SET commands (and the cron during loading runs every 1000 commands), # it'll still not block the loading for long periods of time. - assert {$max_latency <= 30} + if {!$::no_latency} { + assert {$max_latency <= 30} + } } } r config set appendonly no @@ -273,7 +277,9 @@ start_server {tags {"defrag"} overrides {appendonly yes auto-aof-rewrite-percent assert {$frag < 1.1} # due to high fragmentation, 100hz, and active-defrag-cycle-max set to 75, # we expect max latency to be not much higher than 7.5ms but due to rare slowness threshold is set higher - assert {$max_latency <= 30} + if {!$::no_latency} { + assert {$max_latency <= 30} + } } # verify the data isn't corrupted or changed set newdigest [r debug digest] @@ -368,7 +374,9 @@ start_server {tags {"defrag"} overrides {appendonly yes auto-aof-rewrite-percent assert {$frag < 1.1} # due to high fragmentation, 100hz, and active-defrag-cycle-max set to 75, # we expect max latency to be not much higher than 7.5ms but due to rare slowness threshold is set higher - assert {$max_latency <= 30} + if {!$::no_latency} { + assert {$max_latency <= 30} + } # in extreme cases of stagnation, we see over 20m misses before the tests aborts with "defrag didn't stop", # in normal cases we only see 100k misses out of 500k elements