summaryrefslogtreecommitdiff
path: root/tests/sentinel/tests
diff options
context:
space:
mode:
authorWen Hui <wen.hui.ware@gmail.com>2022-02-03 06:20:35 -0500
committerGitHub <noreply@github.com>2022-02-03 13:20:35 +0200
commit65ef543f8cc4d470f554f06e50594e85aad0d617 (patch)
treec9ab6f312d6bdb196d5f699bbb836f1471eb6eca /tests/sentinel/tests
parent53c43fcc847d00d101c1e97563d7e3adc8b94143 (diff)
downloadredis-65ef543f8cc4d470f554f06e50594e85aad0d617.tar.gz
Sentinel: return an error if configuration save fails (#10151)
When performing `SENTINEL SET`, Sentinel updates the local configuration file. Before this commit, failure to update the file would still result with an `+OK` reply. Now, a `-ERR Failed to save config file` error will be returned. Co-authored-by: Yossi Gottlieb <yossigo@gmail.com>
Diffstat (limited to 'tests/sentinel/tests')
-rw-r--r--tests/sentinel/tests/03-runtime-reconf.tcl12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/sentinel/tests/03-runtime-reconf.tcl b/tests/sentinel/tests/03-runtime-reconf.tcl
index ad9284e41..5d6e6b1a5 100644
--- a/tests/sentinel/tests/03-runtime-reconf.tcl
+++ b/tests/sentinel/tests/03-runtime-reconf.tcl
@@ -44,5 +44,17 @@ test "Sentinel Set with other error situations" {
# unknown parameter option
assert_error "ERR Unknown option or number of arguments for SENTINEL SET 'fakeoption'" {S 0 SENTINEL SET mymaster fakeoption fakevalue}
+
+ # save new config to disk failed
+ set info [S 0 SENTINEL master mymaster]
+ set origin_quorum [dict get $info quorum]
+ set update_quorum [expr $origin_quorum+1]
+ set sentinel_id 0
+ set configfilename [file join "sentinel_$sentinel_id" "sentinel.conf"]
+ exec chmod 000 $configfilename
+
+ catch {[S 0 SENTINEL SET mymaster quorum $update_quorum]} err
+ exec chmod 644 $configfilename
+ assert_equal "ERR Failed to save config file" $err
}