diff mbox

[ovs-dev,1/7] ovn: Fix races in MAC_Binding deletion test.

Message ID 1475717212-27467-1-git-send-email-blp@ovn.org
State Accepted
Headers show

Commit Message

Ben Pfaff Oct. 6, 2016, 1:26 a.m. UTC
The test assumed that ovn-northd could delete the MAC_Binding rows
instantly, but it may take a while.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 tests/ovn.at | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Gurucharan Shetty Oct. 7, 2016, 2:24 p.m. UTC | #1
On 5 October 2016 at 18:26, Ben Pfaff <blp@ovn.org> wrote:

> The test assumed that ovn-northd could delete the MAC_Binding rows
> instantly, but it may take a while.
>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  tests/ovn.at | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 948716b..05e1349 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -5108,15 +5108,14 @@ dp_uuid=`ovn-sbctl find datapath | grep uuid | cut
> -f2 -d ":" | cut -f2 -d " "`
>  ovn-sbctl create MAC_Binding ip=10.0.0.1 datapath=$dp_uuid
> logical_port=lp0 mac="mac1"
>  ovn-sbctl create MAC_Binding ip=10.0.0.1 datapath=$dp_uuid
> logical_port=lp1 mac="mac2"
>  ovn-sbctl find MAC_Binding
> -#Delete port lp0
> +# Delete port lp0 and check that its MAC_Binding is deleted.
>  ovn-nbctl lsp-del lp0
>  ovn-sbctl find MAC_Binding
>
Is there is a use for above line?

-AT_CHECK([ovn-sbctl find MAC_Binding logical_port=lp0], [0], [])
> -#Delete ls0. This will verify that the mac_bindings are cleaned up when a
> -#datapath is deleted without explicitly removing the the logical ports
> +OVS_WAIT_UNTIL([test `ovn-sbctl find MAC_Binding logical_port=lp0 | wc
> -l` = 0])
> +# Delete logical switch ls0 and check that its MAC_Binding is deleted.
>  ovn-nbctl ls-del ls0
>  ovn-sbctl find MAC_Binding
> -AT_CHECK([ovn-sbctl find MAC_Binding], [0], [])
> +OVS_WAIT_UNTIL([test `ovn-sbctl find MAC_Binding | wc -l` = 0])
>
>  OVN_CLEANUP([hv1])
>
Acked-by: Gurucharan Shetty <guru@ovn.org>


>
> --
> 2.1.3
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
Ben Pfaff Oct. 7, 2016, 3:29 p.m. UTC | #2
On Fri, Oct 07, 2016 at 07:24:29AM -0700, Guru Shetty wrote:
> On 5 October 2016 at 18:26, Ben Pfaff <blp@ovn.org> wrote:
> 
> > The test assumed that ovn-northd could delete the MAC_Binding rows
> > instantly, but it may take a while.
> >
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> > ---
> >  tests/ovn.at | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/tests/ovn.at b/tests/ovn.at
> > index 948716b..05e1349 100644
> > --- a/tests/ovn.at
> > +++ b/tests/ovn.at
> > @@ -5108,15 +5108,14 @@ dp_uuid=`ovn-sbctl find datapath | grep uuid | cut
> > -f2 -d ":" | cut -f2 -d " "`
> >  ovn-sbctl create MAC_Binding ip=10.0.0.1 datapath=$dp_uuid
> > logical_port=lp0 mac="mac1"
> >  ovn-sbctl create MAC_Binding ip=10.0.0.1 datapath=$dp_uuid
> > logical_port=lp1 mac="mac2"
> >  ovn-sbctl find MAC_Binding
> > -#Delete port lp0
> > +# Delete port lp0 and check that its MAC_Binding is deleted.
> >  ovn-nbctl lsp-del lp0
> >  ovn-sbctl find MAC_Binding
> >
> Is there is a use for above line?

It cannot affect the result of the test.  I guess that it is there so
that if the following OVS_WAIT_UNTIL (formerly AT_CHECK) fails, then the
person reading the log has an idea what was in the MAC_Binding table.
So I think that it is worthwhile enough to leave it in place.

> -AT_CHECK([ovn-sbctl find MAC_Binding logical_port=lp0], [0], [])
> > -#Delete ls0. This will verify that the mac_bindings are cleaned up when a
> > -#datapath is deleted without explicitly removing the the logical ports
> > +OVS_WAIT_UNTIL([test `ovn-sbctl find MAC_Binding logical_port=lp0 | wc
> > -l` = 0])
> > +# Delete logical switch ls0 and check that its MAC_Binding is deleted.
> >  ovn-nbctl ls-del ls0
> >  ovn-sbctl find MAC_Binding
> > -AT_CHECK([ovn-sbctl find MAC_Binding], [0], [])
> > +OVS_WAIT_UNTIL([test `ovn-sbctl find MAC_Binding | wc -l` = 0])
> >
> >  OVN_CLEANUP([hv1])
> >
> Acked-by: Gurucharan Shetty <guru@ovn.org>

Thanks!
diff mbox

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index 948716b..05e1349 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -5108,15 +5108,14 @@  dp_uuid=`ovn-sbctl find datapath | grep uuid | cut -f2 -d ":" | cut -f2 -d " "`
 ovn-sbctl create MAC_Binding ip=10.0.0.1 datapath=$dp_uuid logical_port=lp0 mac="mac1"
 ovn-sbctl create MAC_Binding ip=10.0.0.1 datapath=$dp_uuid logical_port=lp1 mac="mac2"
 ovn-sbctl find MAC_Binding
-#Delete port lp0
+# Delete port lp0 and check that its MAC_Binding is deleted.
 ovn-nbctl lsp-del lp0
 ovn-sbctl find MAC_Binding
-AT_CHECK([ovn-sbctl find MAC_Binding logical_port=lp0], [0], [])
-#Delete ls0. This will verify that the mac_bindings are cleaned up when a
-#datapath is deleted without explicitly removing the the logical ports
+OVS_WAIT_UNTIL([test `ovn-sbctl find MAC_Binding logical_port=lp0 | wc -l` = 0])
+# Delete logical switch ls0 and check that its MAC_Binding is deleted.
 ovn-nbctl ls-del ls0
 ovn-sbctl find MAC_Binding
-AT_CHECK([ovn-sbctl find MAC_Binding], [0], [])
+OVS_WAIT_UNTIL([test `ovn-sbctl find MAC_Binding | wc -l` = 0])
 
 OVN_CLEANUP([hv1])