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

Han Zhou zhouhan at gmail.com
Sun Apr 22 16:53:43 UTC 2018


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
    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



More information about the dev mailing list