deflake tracking-redir-broken test (#1628)

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 <ranshid@amazon.com>
This commit is contained in:
ranshid 2025-01-28 12:35:32 +02:00 committed by GitHub
parent e9b8970e72
commit 230efa4fbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -236,20 +236,14 @@ 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]
@ -257,6 +251,15 @@ start_server {tags {"tracking network logreqres:skip"}} {
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} {