NOTE: This patch should not be applied. It is for testing only. Switch ovn-nbctl test suite to use the ovn-nbctl daemon.
Signed-off-by: Jakub Sitnicki <[email protected]> --- tests/ovn-nbctl.at | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at index 62d82287a..ee76ce0f7 100644 --- a/tests/ovn-nbctl.at +++ b/tests/ovn-nbctl.at @@ -9,6 +9,10 @@ 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`" + + dnl Start ovn-nbctl server + start_daemon ovn-nbctl + AT_CHECK([ovn-nbctl init]) AT_CHECK([[sed < stderr ' /vlog|INFO|opened log file/d @@ -19,7 +23,32 @@ m4_define([OVN_NBCTL_TEST_START], # OVN_NBCTL_TEST_STOP m4_define([OVN_NBCTL_TEST_STOP], [AT_CHECK([check_logs "$1"]) - OVS_APP_EXIT_AND_WAIT([ovsdb-server])]) + OVS_APP_EXIT_AND_WAIT([ovsdb-server]) + OVS_APP_EXIT_AND_WAIT([ovn-nbctl]) +]) + +m4_divert_push([PREPARE_TESTS]) +[ +OVN_NBCTL_CLIENT () { + local rc=0 + + # Run ovs-appctl filtering just its stderr. + exec 3>&1 + ovs-appctl -t ovn-nbctl run "$@" 2>&1 >&3 3>&- | sed '/^ovs-appctl:/d;s/^/ovn-nbctl: /' 1>&2 3>&- + rc=$PIPESTATUS + exec 3>&- + + # Map ovs-appctl exit status to ones from ovn-nbctl + if [ $rc -eq 0 ]; then + rc=0 + else + rc=1 + fi + return $rc +} +alias ovn-nbctl='OVN_NBCTL_CLIENT' +] +m4_divert_pop([PREPARE_TESTS]) AT_SETUP([ovn-nbctl - basic switch commands]) -- 2.14.4 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
