Skip to content

Commit

Permalink
deflake tracking-redir-broken test (#1628)
Browse files Browse the repository at this point in the history
This address 2 issues:

1. It is possible (somehow) that the inner server client (r) was not
working resp 3 when entering this test.
this makes sure it does.

2. in case the test failed it might leave the redirection client closed.
there is a cross test assumption it should be open, so moved most of the
assert checks to the end of the test.

example fail:
https://github.com/valkey-io/valkey/actions/runs/12979601179/job/36195523412

---------

Signed-off-by: Ran Shidlansik <[email protected]>
  • Loading branch information
ranshid authored Jan 28, 2025
1 parent e9b8970 commit 230efa4
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/unit/tracking.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -236,27 +236,30 @@ start_server {tags {"tracking network logreqres:skip"}} {
}

test {RESP3 Client gets tracking-redir-broken push message after cached key changed when rediretion client is terminated} {
# make sure r is working resp 3
r HELLO 3
r CLIENT TRACKING on REDIRECT $redir_id
$rd_sg SET key1 1
r GET key1
$rd_redirection QUIT
assert_equal OK [$rd_redirection read]
$rd_sg SET key1 2
set MAX_TRIES 100
set res -1
for {set i 0} {$i <= $MAX_TRIES && $res < 0} {incr i} {
set res [lsearch -exact [r PING] "tracking-redir-broken"]
}
assert {$res >= 0}
# Consume PING reply
assert_equal PONG [r read]

# Reinstantiating after QUIT
set rd_redirection [valkey_deferring_client]
$rd_redirection CLIENT ID
set redir_id [$rd_redirection read]
$rd_redirection SUBSCRIBE __redis__:invalidate
$rd_redirection read ; # Consume the SUBSCRIBE reply

# Wait to read the tracking-redir-broken
wait_for_condition 1000 50 {
[lsearch -exact [r PING] "tracking-redir-broken"]
} else {
fail "Failed to get redirect broken indication"
}
# Consume PING reply
assert_equal PONG [r read]
}

test {Different clients can redirect to the same connection} {
Expand Down

0 comments on commit 230efa4

Please sign in to comment.