From 39ce98163a8e455381ca1cfa57a2da93869d3eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20S=C3=B6derqvist?= Date: Thu, 5 Aug 2021 07:20:30 +0200 Subject: [PATCH] redis-cli ASK redirect test: Add retry loop to fix timing issue (#9315) (cherry picked from commit 1c59567a7fe207997eef6197eefa7d508d7fbf9f) --- tests/integration/redis-cli.tcl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/integration/redis-cli.tcl b/tests/integration/redis-cli.tcl index 3ac36c2dd..3117cb6a5 100644 --- a/tests/integration/redis-cli.tcl +++ b/tests/integration/redis-cli.tcl @@ -223,8 +223,13 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS set p2 [exec $tclsh $script $port2 \ "ASKING" "+OK" \ "SET foo bar" "+OK" &] - # Sleep to make sure both fake nodes have started listening - after 100 + # Make sure both fake nodes have started listening + wait_for_condition 50 50 { + [catch {close [socket "127.0.0.1" $port1]}] == 0 && \ + [catch {close [socket "127.0.0.1" $port2]}] == 0 + } else { + fail "Failed to start fake Redis nodes" + } # Run the cli assert_equal "OK" [run_cli_host_port_db "127.0.0.1" $port1 0 -c SET foo bar] } @@ -238,7 +243,6 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS test_nontty_cli "No accidental unquoting of input arguments" { run_cli --quoted-input set {"\x41\x41"} quoted-val run_cli set {"\x41\x41"} unquoted-val - assert_equal "quoted-val" [r get AA] assert_equal "unquoted-val" [r get {"\x41\x41"}] }