[ovs-dev] [PATCH] tests: Fix ovn test failures in sandbox test env.

aginwala aginwala at asu.edu
Mon Apr 23 08:46:41 UTC 2018


On Sun, Apr 22, 2018 at 9:53 AM, Han Zhou <zhouhan at gmail.com> wrote:

> When clustering support is introduced, the naming convention of
> environment variables OVN_NB_DB and OVN_SB_DB changed (something
> like unix:nb1.ovsdb). This leads to all ovn-nbctl test cases and
> many others fail when they are run in sandbox environment, because
> in those test cases the naming convention of DBs are not changed.
>
> This patch fix the issue by setting the environment variables
> properly in those test cases.
>
> Signed-off-by: Han Zhou <hzhou8 at ebay.com>
> ---
>  tests/ovn-controller-vtep.at | 2 ++
>  tests/ovn-nbctl.at           | 1 +
>  tests/ovn-sbctl.at           | 4 +++-
>  3 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at
> index 416e954..caed026 100644
> --- a/tests/ovn-controller-vtep.at
> +++ b/tests/ovn-controller-vtep.at
> @@ -27,6 +27,8 @@ m4_define([OVN_CONTROLLER_VTEP_START],
>     AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file
> --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db], [0], [],
> [stderr])
>     AT_CHECK([ovsdb-server --detach --no-chdir
> --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log
> --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db], [0], [], [stderr])
>     AT_CHECK([ovsdb-server --detach --no-chdir
> --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log
> --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db], [0], [],
> [stderr])
> +   AS_VAR_SET([OVN_NB_DB], [unix:$OVS_RUNDIR/ovnnb_db.sock]); export
> OVN_NB_DB
> +   AS_VAR_SET([OVN_SB_DB], [unix:$OVS_RUNDIR/ovnsb_db.sock]); export
> OVN_SB_DB
>     on_exit "kill `cat ovsdb-server.pid` `cat ovsdb-nb-server.pid` `cat
> ovsdb-sb-server.pid`"
>     AT_CHECK([[sed < stderr '
>  /vlog|INFO|opened log file/d
> diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at
> index 514e7e7..c7ebe51 100644
> --- a/tests/ovn-nbctl.at
> +++ b/tests/ovn-nbctl.at
> @@ -9,6 +9,7 @@ m4_define([OVN_NBCTL_TEST_START],
>     dnl Start ovsdb-server.
>     AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file
> --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db], [0], [], [stderr])
>     on_exit "kill `cat ovsdb-server.pid`"
> +   AS_VAR_SET([OVN_NB_DB], [unix:$OVS_RUNDIR/ovnnb_db.sock]); export
> OVN_NB_DB
>
 >> Since we are now using nb1.db and sb1.db for sandbox too, better use
the same for UTs to be in sync.
env | grep OVN
OVN_SB_DB=unix:sb1.ovsdb
OVN_NB_DB=unix:nb1.ovsdb

Would need similar change for sbctl and controller-vtep. Thoughts? :)

e.g. diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at
index 514e7e7..981567b 100644
--- a/tests/ovn-nbctl.at
+++ b/tests/ovn-nbctl.at
@@ -4,11 +4,12 @@ AT_BANNER([ovn-nbctl])
 m4_define([OVN_NBCTL_TEST_START],
   [dnl Create ovn-nb database.
    AT_KEYWORDS([ovn])
-   AT_CHECK([ovsdb-tool create ovn-nb.db $abs_top_srcdir/ovn/ovn-nb.ovs
schema])
+   AT_CHECK([ovsdb-tool create nb1.db $abs_top_srcdir/ovn/ovn-nb.ovs
schema])

    dnl Start ovsdb-server.
-   AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file
--remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db], [0], [], [stderr])
+   AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file
--remote=punix:$OVS_RUNDIR/nb1.ovsdb nb1.db], [0], [], [stderr])
    on_exit "kill `cat ovsdb-server.pid`"
+   AS_VAR_SET([OVN_NB_DB], [unix:$OVS_RUNDIR/nb1.ovsdb]); export OVN_NB_DB


    AT_CHECK([ovn-nbctl init])
>     AT_CHECK([[sed < stderr '
>  /vlog|INFO|opened log file/d
> diff --git a/tests/ovn-sbctl.at b/tests/ovn-sbctl.at
> index df9a8a2..41a1a36 100644
> --- a/tests/ovn-sbctl.at
> +++ b/tests/ovn-sbctl.at
> @@ -12,6 +12,8 @@ m4_define([OVN_SBCTL_TEST_START],
>     AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=ovnnb_db.pid
> --unixctl=$OVS_RUNDIR/ovnnb_db.ctl --log-file=ovsdb_nb.log
> --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db ], [0], [], [stderr])
>     AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=ovnsb_db.pid
> --unixctl=$OVS_RUNDIR/ovnsb_db.ctl --log-file=ovsdb_sb.log
> --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db], [0], [], [stderr])
>     on_exit "kill `cat ovnnb_db.pid` `cat ovnsb_db.pid`"
> +   AS_VAR_SET([OVN_NB_DB], [unix:$OVS_RUNDIR/ovnnb_db.sock]); export
> OVN_NB_DB
> +   AS_VAR_SET([OVN_SB_DB], [unix:$OVS_RUNDIR/ovnsb_db.sock]); export
> OVN_SB_DB
>     AT_CHECK([[sed < stderr '
>  /vlog|INFO|opened log file/d
>  /ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']])
> @@ -147,4 +149,4 @@ inactivity_probe    : 30000
>  ])
>
>  OVN_SBCTL_TEST_STOP
> -AT_CLEANUP
> \ No newline at end of file
> +AT_CLEANUP
> --
> 2.1.0
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>


More information about the dev mailing list