summaryrefslogtreecommitdiff
path: root/tests/unit/shutdown.tcl
diff options
context:
space:
mode:
authorBinbin <binloveplay1314@qq.com>2023-04-18 21:14:26 +0800
committerGitHub <noreply@github.com>2023-04-18 16:14:26 +0300
commit20533cc1d7684e3ffc8c74bbd6725e4189de6939 (patch)
treed9b04973990a412024680d7648c915f4e7623bef /tests/unit/shutdown.tcl
parent42c8c61813a8c3287b8acb3155473551a491aa2b (diff)
downloadredis-20533cc1d7684e3ffc8c74bbd6725e4189de6939.tar.gz
Tests: Do not save an RDB by default and add a SIGTERM default AOFRW test (#12064)
In order to speed up tests, avoid saving an RDB (mostly notable on shutdown), except for tests that explicitly test the RDB mechanism In addition, use `shutdown-on-sigterm force` to prevetn shutdown from failing in case the server is in the middle of the initial AOFRW Also a a test that checks that the `shutdown-on-sigterm default` is to refuse shutdown if there's an initial AOFRW Co-authored-by: Guy Benoish <guy.benoish@redislabs.com>
Diffstat (limited to 'tests/unit/shutdown.tcl')
-rw-r--r--tests/unit/shutdown.tcl30
1 files changed, 27 insertions, 3 deletions
diff --git a/tests/unit/shutdown.tcl b/tests/unit/shutdown.tcl
index b419c83a1..7504851a1 100644
--- a/tests/unit/shutdown.tcl
+++ b/tests/unit/shutdown.tcl
@@ -30,7 +30,7 @@ start_server {tags {"shutdown external:skip"}} {
}
}
-start_server {tags {"shutdown external:skip"}} {
+start_server {tags {"shutdown external:skip"} overrides {save {900 1}}} {
test {SHUTDOWN ABORT can cancel SIGTERM} {
r debug pause-cron 1
set pid [s process_id]
@@ -48,7 +48,7 @@ start_server {tags {"shutdown external:skip"}} {
}
# It will cost 2s (20 * 100ms) to dump rdb
r config set rdb-key-save-delay 100000
-
+
set pid [s process_id]
set temp_rdb [file join [lindex [r config get dir] 1] temp-${pid}.rdb]
@@ -72,7 +72,7 @@ start_server {tags {"shutdown external:skip"}} {
}
}
-start_server {tags {"shutdown external:skip"}} {
+start_server {tags {"shutdown external:skip"} overrides {save {900 1}}} {
set pid [s process_id]
set dump_rdb [file join [lindex [r config get dir] 1] dump.rdb]
@@ -107,3 +107,27 @@ start_server {tags {"shutdown external:skip"}} {
exec rm -r $dump_rdb
}
}
+
+
+start_server {tags {"shutdown external:skip"} overrides {appendonly no}} {
+ test {SHUTDOWN SIGTERM will abort if there's an initial AOFRW - default} {
+ r config set shutdown-on-sigterm default
+ r config set rdb-key-save-delay 10000000
+ for {set i 0} {$i < 10} {incr i} {
+ r set $i $i
+ }
+
+ r config set appendonly yes
+ wait_for_condition 1000 10 {
+ [s aof_rewrite_in_progress] eq 1
+ } else {
+ fail "aof rewrite did not start in time"
+ }
+
+ set pid [s process_id]
+ exec kill -SIGTERM $pid
+ wait_for_log_messages 0 {"*Writing initial AOF, can't exit*"} 0 1000 10
+
+ r config set shutdown-on-sigterm force
+ }
+}