diff options
author | Oran Agra <oran@redislabs.com> | 2020-07-31 13:14:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-31 13:14:29 +0300 |
commit | f7e77759902aa19cfa537ed454e6bc987498e8c5 (patch) | |
tree | 388625ca07a8af2dc65517cac927029b9690bfb3 /tests/unit/moduleapi | |
parent | 50f5181488d9c3a5557a0b32249a4acdd70684ce (diff) | |
download | redis-f7e77759902aa19cfa537ed454e6bc987498e8c5.tar.gz |
module hook for master link up missing on successful psync (#7584)
besides, hooks test was time sensitive. when the replica managed to
reconnect quickly after the client kill, the test would fail
Diffstat (limited to 'tests/unit/moduleapi')
-rw-r--r-- | tests/unit/moduleapi/hooks.tcl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/unit/moduleapi/hooks.tcl b/tests/unit/moduleapi/hooks.tcl index bf2b9010b..da0307ce6 100644 --- a/tests/unit/moduleapi/hooks.tcl +++ b/tests/unit/moduleapi/hooks.tcl @@ -114,6 +114,21 @@ tags "modules" { test {Test master link down hook} { r client kill type master assert_equal [r hooks.event_count masterlink-down] 1 + + wait_for_condition 50 100 { + [string match {*master_link_status:up*} [r info replication]] + } else { + fail "Replica didn't reconnect" + } + + assert_equal [r hooks.event_count masterlink-down] 1 + assert_equal [r hooks.event_count masterlink-up] 2 + } + + wait_for_condition 50 10 { + [string match {*master_link_status:up*} [r info replication]] + } else { + fail "Can't turn the instance into a replica" } $replica replicaof no one @@ -125,8 +140,8 @@ tags "modules" { } test {Test replica-offline hook} { - assert_equal [r -1 hooks.event_count replica-online] 1 - assert_equal [r -1 hooks.event_count replica-offline] 1 + assert_equal [r -1 hooks.event_count replica-online] 2 + assert_equal [r -1 hooks.event_count replica-offline] 2 } # get the replica stdout, to be used by the next test set replica_stdout [srv 0 stdout] |