From: Valentine Krasnobaeva Date: Wed, 16 Oct 2024 16:27:30 +0000 (+0200) Subject: REGTESTS: cli: add delay 0.1 before connect to cli X-Git-Tag: v3.1-dev10~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5bbcdc003ab3a48c12f25be84f843f0e5756b1e0;p=thirdparty%2Fhaproxy.git REGTESTS: cli: add delay 0.1 before connect to cli When vtest starts haproxy process, it loops until the moment, when haproxy pidfile is created. When pidfile is created, vtest considers that haproxy process is ready and it starts to perform test commands, in particular, it connects to CLI. It's not very reliable approach to base the check of the process readiness on the PID file. After master-worker architecture refactoring pidfile is created in the early init stage, but master and worker are not yet finished its initialization routines. So, all mcli tests and some tests where we sent commands to CLI start to fail regularly. In vtest at the moment there is no any other approach to check that the process is really ready. So let's add a delay 0.1s before connecting to CLI in all mcli tests and in acl_cli_spaces test. --- diff --git a/reg-tests/http-rules/acl_cli_spaces.vtc b/reg-tests/http-rules/acl_cli_spaces.vtc index 334133d919..81b7b0dcf4 100644 --- a/reg-tests/http-rules/acl_cli_spaces.vtc +++ b/reg-tests/http-rules/acl_cli_spaces.vtc @@ -33,6 +33,7 @@ client c1 -connect ${h1_fe1_sock} { } -run haproxy h1 -cli { + delay 0.1 send "add acl ${testdir}/agents.acl Mon\\ User\\ Agent\\;" expect ~ .* @@ -48,6 +49,7 @@ client c1 -connect ${h1_fe1_sock} { haproxy h1 -cli { + delay 0.1 send "del acl ${testdir}/agents.acl Mon\\ User\\ Agent\\;" expect ~ .* @@ -64,6 +66,7 @@ client c1 -connect ${h1_fe1_sock} { # Try it with the master CLI haproxy h1 -mcli { + delay 0.1 send "@1 add acl ${testdir}/agents.acl Mon\\ User\\ Agent\\;;@1 show acl ${testdir}/agents.acl" expect ~ ".*Mon User Agent;.*" } diff --git a/reg-tests/mcli/mcli_debug_dev.vtc b/reg-tests/mcli/mcli_debug_dev.vtc index beab616047..147ff0dc7d 100644 --- a/reg-tests/mcli/mcli_debug_dev.vtc +++ b/reg-tests/mcli/mcli_debug_dev.vtc @@ -38,6 +38,7 @@ haproxy h1 -W -S -conf { } -start haproxy h1 -mcli { + delay 0.1 send "@1; expert-mode on; debug dev log Victory" expect ~ ".*" } -wait diff --git a/reg-tests/mcli/mcli_show_info.vtc b/reg-tests/mcli/mcli_show_info.vtc index 3c44461a77..276488a1b8 100644 --- a/reg-tests/mcli/mcli_show_info.vtc +++ b/reg-tests/mcli/mcli_show_info.vtc @@ -22,6 +22,7 @@ haproxy h1 -W -S -conf { } -start haproxy h1 -mcli { + delay 0.1 send "@1 show info" expect ~ ".*\nProcess_num: 1\n.*" } -wait diff --git a/reg-tests/mcli/mcli_start_progs.vtc b/reg-tests/mcli/mcli_start_progs.vtc index 51b335ce5e..c812288e01 100644 --- a/reg-tests/mcli/mcli_start_progs.vtc +++ b/reg-tests/mcli/mcli_start_progs.vtc @@ -31,6 +31,7 @@ haproxy h1 -W -S -conf { } -start haproxy h1 -mcli { + delay 0.1 send "show proc" expect ~ ".*foo.*\n.*bar.*\n" } -wait