diff mbox series

[ovs-dev] ovsdb-cluster.at: Fix infinite loop in torture tests.

Message ID 20201126101729.645346-1-i.maximets@ovn.org
State Accepted
Headers show
Series [ovs-dev] ovsdb-cluster.at: Fix infinite loop in torture tests. | expand

Commit Message

Ilya Maximets Nov. 26, 2020, 10:17 a.m. UTC
For some reason, while running cluster torture tests in GitHub Actions
workflow, failure of 'echo' command doesn't fail the loop and subshell
never exits, but keeps infinitely printing errors after breaking from
the loop on the right side of the pipeline:

  testsuite: line 8591: echo: write error: Broken pipe

Presumably, that is caused by some shell configuration option, but
I have no idea which one and I'm not able to reproduce locally with
shell configuration options provided in GitHub documentation.
Let's just add an explicit 'exit' on 'echo' failure.  This will
guarantee exit from the loop and the subshell regardless of
configuration.

CC: Ben Pfaff <blp@ovn.org>
Fixes: 0f03ae3754ec ("ovsdb: Improve timing in cluster torture test.")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---

GHA shell configuration:
https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell

 tests/ovsdb-cluster.at | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ilya Maximets Dec. 4, 2020, 8:16 p.m. UTC | #1
On 11/26/20 11:17 AM, Ilya Maximets wrote:
> For some reason, while running cluster torture tests in GitHub Actions
> workflow, failure of 'echo' command doesn't fail the loop and subshell
> never exits, but keeps infinitely printing errors after breaking from
> the loop on the right side of the pipeline:
> 
>   testsuite: line 8591: echo: write error: Broken pipe
> 
> Presumably, that is caused by some shell configuration option, but
> I have no idea which one and I'm not able to reproduce locally with
> shell configuration options provided in GitHub documentation.
> Let's just add an explicit 'exit' on 'echo' failure.  This will
> guarantee exit from the loop and the subshell regardless of
> configuration.
> 
> CC: Ben Pfaff <blp@ovn.org>
> Fixes: 0f03ae3754ec ("ovsdb: Improve timing in cluster torture test.")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---

It doesn't make much sense to have this change on branches 2.11 and 2.10,
but to not have on later ones, so I cherry-picked this commit from 2.11
to all newer branches.

Best regards, Ilya Maximets.

> 
> GHA shell configuration:
> https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
> 
>  tests/ovsdb-cluster.at | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/ovsdb-cluster.at b/tests/ovsdb-cluster.at
> index e0758e954..92aa42709 100644
> --- a/tests/ovsdb-cluster.at
> +++ b/tests/ovsdb-cluster.at
> @@ -701,7 +701,7 @@ ovsdb|WARN|schema: changed 30 columns in 'Open_vSwitch' database from ephemeral
>      # Use file instead of var because code inside "while" runs in a subshell.
>      echo 0 > phase
>      i=0
> -    (while :; do echo; sleep 0.1; done) | while read REPLY; do
> +    (while :; do echo || exit 0; sleep 0.1; done) | while read REPLY; do
>          printf "t=%2d s:" $i
>          done=0
>          for j in $(seq 0 $(expr $n1 - 1)); do
>
diff mbox series

Patch

diff --git a/tests/ovsdb-cluster.at b/tests/ovsdb-cluster.at
index e0758e954..92aa42709 100644
--- a/tests/ovsdb-cluster.at
+++ b/tests/ovsdb-cluster.at
@@ -701,7 +701,7 @@  ovsdb|WARN|schema: changed 30 columns in 'Open_vSwitch' database from ephemeral
     # Use file instead of var because code inside "while" runs in a subshell.
     echo 0 > phase
     i=0
-    (while :; do echo; sleep 0.1; done) | while read REPLY; do
+    (while :; do echo || exit 0; sleep 0.1; done) | while read REPLY; do
         printf "t=%2d s:" $i
         done=0
         for j in $(seq 0 $(expr $n1 - 1)); do