diff mbox series

[ovs-dev] ovn-controller.at: Fix test for debug/delay-nb-cfg-report.

Message ID 1599761867-122691-1-git-send-email-hzhou@ovn.org
State Accepted
Headers show
Series [ovs-dev] ovn-controller.at: Fix test for debug/delay-nb-cfg-report. | expand

Commit Message

Han Zhou Sept. 10, 2020, 6:17 p.m. UTC
In the test case for debug/delay-nb-cfg-report, it sets the delay as
2 seconds, and firstly triggered a sync with wait timeout being 1 sec
and expects the wait timedout, and then it immediately started another
sync with wait timeout being 3 sec, expecting it not timing out.

However, since 2 + 2 = 1 + 3, there is a good chance that the second
wait would still time out, so the test fails occasionally. This patch
fixes it by sleep another 1 sec to let the 1st delay complete before
starting the second sync and wait.

Reported-by: Ilya Maximets <i.maximets@ovn.org>
Fixes: a8182e21484 ("ovn-controller: Unix command debug/delay-nb-cfg-report.")
Signed-off-by: Han Zhou <hzhou@ovn.org>
---
 tests/ovn-controller.at | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ilya Maximets Sept. 10, 2020, 7:48 p.m. UTC | #1
On 9/10/20 8:17 PM, Han Zhou wrote:
> In the test case for debug/delay-nb-cfg-report, it sets the delay as
> 2 seconds, and firstly triggered a sync with wait timeout being 1 sec
> and expects the wait timedout, and then it immediately started another
> sync with wait timeout being 3 sec, expecting it not timing out.
> 
> However, since 2 + 2 = 1 + 3, there is a good chance that the second
> wait would still time out, so the test fails occasionally. This patch
> fixes it by sleep another 1 sec to let the 1st delay complete before
> starting the second sync and wait.
> 
> Reported-by: Ilya Maximets <i.maximets@ovn.org>
> Fixes: a8182e21484 ("ovn-controller: Unix command debug/delay-nb-cfg-report.")
> Signed-off-by: Han Zhou <hzhou@ovn.org>
> ---

Without this patch test fails  on Travis more frequently than succeeds.
With this patch tests survived more than 1000 iterations on Travis without
failure.

Tested-by: Ilya Maximets <i.maximets@ovn.org>

>  tests/ovn-controller.at | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
> index 7ed5216..d806134 100644
> --- a/tests/ovn-controller.at
> +++ b/tests/ovn-controller.at
> @@ -402,6 +402,9 @@ AT_CHECK([ovn-appctl -t ovn-controller debug/delay-nb-cfg-report 2], [0],
>  
>  AT_FAIL_IF([ovn-nbctl --timeout=1 --wait=hv sync])
>  
> +# sleep another 1 sec so that the original 2 sec sleep is done in ovn-controller
> +sleep 1
> +
>  AT_CHECK([ovn-nbctl --timeout=3 --wait=hv sync])
>  
>  AT_CHECK([ovn-appctl -t ovn-controller debug/delay-nb-cfg-report 0], [0],
>
Han Zhou Sept. 10, 2020, 7:55 p.m. UTC | #2
On Thu, Sep 10, 2020 at 12:48 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> On 9/10/20 8:17 PM, Han Zhou wrote:
> > In the test case for debug/delay-nb-cfg-report, it sets the delay as
> > 2 seconds, and firstly triggered a sync with wait timeout being 1 sec
> > and expects the wait timedout, and then it immediately started another
> > sync with wait timeout being 3 sec, expecting it not timing out.
> >
> > However, since 2 + 2 = 1 + 3, there is a good chance that the second
> > wait would still time out, so the test fails occasionally. This patch
> > fixes it by sleep another 1 sec to let the 1st delay complete before
> > starting the second sync and wait.
> >
> > Reported-by: Ilya Maximets <i.maximets@ovn.org>
> > Fixes: a8182e21484 ("ovn-controller: Unix command
debug/delay-nb-cfg-report.")
> > Signed-off-by: Han Zhou <hzhou@ovn.org>
> > ---
>
> Without this patch test fails  on Travis more frequently than succeeds.
> With this patch tests survived more than 1000 iterations on Travis without
> failure.
>
> Tested-by: Ilya Maximets <i.maximets@ovn.org>
>

Thanks Ilya. I applied the fix.

> >  tests/ovn-controller.at | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
> > index 7ed5216..d806134 100644
> > --- a/tests/ovn-controller.at
> > +++ b/tests/ovn-controller.at
> > @@ -402,6 +402,9 @@ AT_CHECK([ovn-appctl -t ovn-controller
debug/delay-nb-cfg-report 2], [0],
> >
> >  AT_FAIL_IF([ovn-nbctl --timeout=1 --wait=hv sync])
> >
> > +# sleep another 1 sec so that the original 2 sec sleep is done in
ovn-controller
> > +sleep 1
> > +
> >  AT_CHECK([ovn-nbctl --timeout=3 --wait=hv sync])
> >
> >  AT_CHECK([ovn-appctl -t ovn-controller debug/delay-nb-cfg-report 0],
[0],
> >
>
diff mbox series

Patch

diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index 7ed5216..d806134 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -402,6 +402,9 @@  AT_CHECK([ovn-appctl -t ovn-controller debug/delay-nb-cfg-report 2], [0],
 
 AT_FAIL_IF([ovn-nbctl --timeout=1 --wait=hv sync])
 
+# sleep another 1 sec so that the original 2 sec sleep is done in ovn-controller
+sleep 1
+
 AT_CHECK([ovn-nbctl --timeout=3 --wait=hv sync])
 
 AT_CHECK([ovn-appctl -t ovn-controller debug/delay-nb-cfg-report 0], [0],