test infra - wait_done_loading
reduce code duplication in aof.tcl. move creation of clients into the test so that it can be skipped
This commit is contained in:
parent
2468c17a32
commit
cc455a710c
@ -52,15 +52,9 @@ tags {"aof"} {
|
|||||||
assert_equal 1 [is_alive $srv]
|
assert_equal 1 [is_alive $srv]
|
||||||
}
|
}
|
||||||
|
|
||||||
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
|
||||||
|
|
||||||
wait_for_condition 50 100 {
|
|
||||||
[catch {$client ping} e] == 0
|
|
||||||
} else {
|
|
||||||
fail "Loading DB is taking too much time."
|
|
||||||
}
|
|
||||||
|
|
||||||
test "Truncated AOF loaded: we expect foo to be equal to 5" {
|
test "Truncated AOF loaded: we expect foo to be equal to 5" {
|
||||||
|
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
||||||
|
wait_done_loading $client
|
||||||
assert {[$client get foo] eq "5"}
|
assert {[$client get foo] eq "5"}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,15 +69,9 @@ tags {"aof"} {
|
|||||||
assert_equal 1 [is_alive $srv]
|
assert_equal 1 [is_alive $srv]
|
||||||
}
|
}
|
||||||
|
|
||||||
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
|
||||||
|
|
||||||
wait_for_condition 50 100 {
|
|
||||||
[catch {$client ping} e] == 0
|
|
||||||
} else {
|
|
||||||
fail "Loading DB is taking too much time."
|
|
||||||
}
|
|
||||||
|
|
||||||
test "Truncated AOF loaded: we expect foo to be equal to 6 now" {
|
test "Truncated AOF loaded: we expect foo to be equal to 6 now" {
|
||||||
|
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
||||||
|
wait_done_loading $client
|
||||||
assert {[$client get foo] eq "6"}
|
assert {[$client get foo] eq "6"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,11 +171,7 @@ tags {"aof"} {
|
|||||||
|
|
||||||
test "Fixed AOF: Keyspace should contain values that were parseable" {
|
test "Fixed AOF: Keyspace should contain values that were parseable" {
|
||||||
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
||||||
wait_for_condition 50 100 {
|
wait_done_loading $client
|
||||||
[catch {$client ping} e] == 0
|
|
||||||
} else {
|
|
||||||
fail "Loading DB is taking too much time."
|
|
||||||
}
|
|
||||||
assert_equal "hello" [$client get foo]
|
assert_equal "hello" [$client get foo]
|
||||||
assert_equal "" [$client get bar]
|
assert_equal "" [$client get bar]
|
||||||
}
|
}
|
||||||
@ -207,11 +191,7 @@ tags {"aof"} {
|
|||||||
|
|
||||||
test "AOF+SPOP: Set should have 1 member" {
|
test "AOF+SPOP: Set should have 1 member" {
|
||||||
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
||||||
wait_for_condition 50 100 {
|
wait_done_loading $client
|
||||||
[catch {$client ping} e] == 0
|
|
||||||
} else {
|
|
||||||
fail "Loading DB is taking too much time."
|
|
||||||
}
|
|
||||||
assert_equal 1 [$client scard set]
|
assert_equal 1 [$client scard set]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,11 +211,7 @@ tags {"aof"} {
|
|||||||
|
|
||||||
test "AOF+SPOP: Set should have 1 member" {
|
test "AOF+SPOP: Set should have 1 member" {
|
||||||
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
||||||
wait_for_condition 50 100 {
|
wait_done_loading $client
|
||||||
[catch {$client ping} e] == 0
|
|
||||||
} else {
|
|
||||||
fail "Loading DB is taking too much time."
|
|
||||||
}
|
|
||||||
assert_equal 1 [$client scard set]
|
assert_equal 1 [$client scard set]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,11 +230,7 @@ tags {"aof"} {
|
|||||||
|
|
||||||
test "AOF+EXPIRE: List should be empty" {
|
test "AOF+EXPIRE: List should be empty" {
|
||||||
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
|
||||||
wait_for_condition 50 100 {
|
wait_done_loading $client
|
||||||
[catch {$client ping} e] == 0
|
|
||||||
} else {
|
|
||||||
fail "Loading DB is taking too much time."
|
|
||||||
}
|
|
||||||
assert_equal 0 [$client llen list]
|
assert_equal 0 [$client llen list]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,14 @@ proc wait_for_ofs_sync {r1 r2} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc wait_done_loading r {
|
||||||
|
wait_for_condition 50 100 {
|
||||||
|
[catch {$r ping} e] == 0
|
||||||
|
} else {
|
||||||
|
fail "Loading DB is taking too much time."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# count current log lines in server's stdout
|
# count current log lines in server's stdout
|
||||||
proc count_log_lines {srv_idx} {
|
proc count_log_lines {srv_idx} {
|
||||||
set _ [exec wc -l < [srv $srv_idx stdout]]
|
set _ [exec wc -l < [srv $srv_idx stdout]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user