Commit 1b7ba44e authored by Oran Agra's avatar Oran Agra
Browse files

test infra - wait_done_loading

reduce code duplication in aof.tcl.
move creation of clients into the test so that it can be skipped
parent b65e5aca
......@@ -52,15 +52,9 @@ tags {"aof"} {
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" {
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
wait_done_loading $client
assert {[$client get foo] eq "5"}
}
......@@ -75,15 +69,9 @@ tags {"aof"} {
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" {
set client [redis [dict get $srv host] [dict get $srv port] 0 $::tls]
wait_done_loading $client
assert {[$client get foo] eq "6"}
}
}
......@@ -183,11 +171,7 @@ tags {"aof"} {
test "Fixed AOF: Keyspace should contain values that were parseable" {
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."
}
wait_done_loading $client
assert_equal "hello" [$client get foo]
assert_equal "" [$client get bar]
}
......@@ -207,11 +191,7 @@ tags {"aof"} {
test "AOF+SPOP: Set should have 1 member" {
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."
}
wait_done_loading $client
assert_equal 1 [$client scard set]
}
}
......@@ -231,11 +211,7 @@ tags {"aof"} {
test "AOF+SPOP: Set should have 1 member" {
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."
}
wait_done_loading $client
assert_equal 1 [$client scard set]
}
}
......@@ -254,11 +230,7 @@ tags {"aof"} {
test "AOF+EXPIRE: List should be empty" {
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."
}
wait_done_loading $client
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
proc count_log_lines {srv_idx} {
set _ [exec wc -l < [srv $srv_idx stdout]]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment