diff mbox series

[ovs-dev,v2,14/15] tests: Add test for sync command to ovn-nbctl test suite.

Message ID 20180712134016.14336-15-jkbs@redhat.com
State Superseded
Headers show
Series Daemon mode for ovn-nbctl | expand

Commit Message

Jakub Sitnicki July 12, 2018, 1:40 p.m. UTC
Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
---
 tests/ovn.at | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Mark Michelson July 12, 2018, 9:10 p.m. UTC | #1
This is tough. The problem with a test like this is that you can't 
really tell that the sync is working as intended. It's possible that the 
ovn-nbctl is not actually waiting, but by coincidence, the database has 
its values updated before you check them.

You'd need something internal to ovn-nbctl to let you know that the 
database value has been updated prior to exiting to know for sure that 
the sync is working as intended.

On 07/12/2018 09:40 AM, Jakub Sitnicki wrote:
> Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
> ---
>   tests/ovn.at | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
> 
> diff --git a/tests/ovn.at b/tests/ovn.at
> index d1a8967dd..adb99db77 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -10541,3 +10541,22 @@ OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [vif2.expected])
>   
>   OVN_CLEANUP([hv1], [hv2])
>   AT_CLEANUP
> +
> +AT_SETUP([ovn -- sync])
> +ovn_start
> +
> +AT_CHECK([ovn-nbctl get NB_Global . nb_cfg], [0], [dnl
> +0
> +])
> +
> +AT_CHECK([ovn-nbctl --wait=sb sync])
> +AT_CHECK([ovn-nbctl get NB_Global . sb_cfg], [0], [dnl
> +1
> +])
> +
> +AT_CHECK([ovn-nbctl --wait=hv sync])
> +AT_CHECK([ovn-nbctl get NB_Global . hv_cfg], [0], [dnl
> +2
> +])
> +
> +AT_CLEANUP
>
Jakub Sitnicki July 13, 2018, 8:57 a.m. UTC | #2
On Thu, 12 Jul 2018 17:10:14 -0400
Mark Michelson <mmichels@redhat.com> wrote:

> This is tough. The problem with a test like this is that you can't 
> really tell that the sync is working as intended. It's possible that the 
> ovn-nbctl is not actually waiting, but by coincidence, the database has 
> its values updated before you check them.
> 
> You'd need something internal to ovn-nbctl to let you know that the 
> database value has been updated prior to exiting to know for sure that 
> the sync is working as intended.

How about we switch from 'get' to 'wait-until'? Let me try that.

> 
> On 07/12/2018 09:40 AM, Jakub Sitnicki wrote:
> > Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
> > ---
> >   tests/ovn.at | 19 +++++++++++++++++++
> >   1 file changed, 19 insertions(+)
> > 
> > diff --git a/tests/ovn.at b/tests/ovn.at
> > index d1a8967dd..adb99db77 100644
> > --- a/tests/ovn.at
> > +++ b/tests/ovn.at
> > @@ -10541,3 +10541,22 @@ OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [vif2.expected])
> >   
> >   OVN_CLEANUP([hv1], [hv2])
> >   AT_CLEANUP
> > +
> > +AT_SETUP([ovn -- sync])
> > +ovn_start
> > +
> > +AT_CHECK([ovn-nbctl get NB_Global . nb_cfg], [0], [dnl
> > +0
> > +])
> > +
> > +AT_CHECK([ovn-nbctl --wait=sb sync])
> > +AT_CHECK([ovn-nbctl get NB_Global . sb_cfg], [0], [dnl
> > +1
> > +])
> > +
> > +AT_CHECK([ovn-nbctl --wait=hv sync])
> > +AT_CHECK([ovn-nbctl get NB_Global . hv_cfg], [0], [dnl
> > +2
> > +])
> > +
> > +AT_CLEANUP
> >   
>
diff mbox series

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index d1a8967dd..adb99db77 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -10541,3 +10541,22 @@  OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [vif2.expected])
 
 OVN_CLEANUP([hv1], [hv2])
 AT_CLEANUP
+
+AT_SETUP([ovn -- sync])
+ovn_start
+
+AT_CHECK([ovn-nbctl get NB_Global . nb_cfg], [0], [dnl
+0
+])
+
+AT_CHECK([ovn-nbctl --wait=sb sync])
+AT_CHECK([ovn-nbctl get NB_Global . sb_cfg], [0], [dnl
+1
+])
+
+AT_CHECK([ovn-nbctl --wait=hv sync])
+AT_CHECK([ovn-nbctl get NB_Global . hv_cfg], [0], [dnl
+2
+])
+
+AT_CLEANUP