new tests were introduced based on lcov report, which point out this part of the code is not covered by ovs test suites.
Signed-off-by: Damijan Skvarc <[email protected]> --- tests/vtep-ctl.at | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/tests/vtep-ctl.at b/tests/vtep-ctl.at index 3949f16..9806765 100644 --- a/tests/vtep-ctl.at +++ b/tests/vtep-ctl.at @@ -129,6 +129,39 @@ m4_define([CHECK_LSWITCHES], AT_CHECK([RUN_VTEP_CTL([ls-exists nonexistent])], [2], [], [], [VTEP_CTL_CLEANUP])]) + +dnl CHECK_LROUTERS([LROUTER], ...) +dnl +dnl Verifies that "vtep-ctl list-lr" prints the specified list of +dnl logical routers, which must be in alphabetical order. +m4_define([CHECK_LROUTERS], + [dnl Check that the lrouters appear on list-lr, without --oneline. + AT_CHECK( + [RUN_VTEP_CTL([list-lr])], + [0], + [m4_foreach([lrinfo], [$@], [m4_car(lrinfo) +])], + [], + [VTEP_CTL_CLEANUP]) + + dnl Check that the lswitches appear on list-lr, with --oneline. + AT_CHECK( + [RUN_VTEP_CTL_ONELINE([list-lr])], + [0], + [m4_join([\n], m4_foreach([lrinfo], [$@], [m4_car(lrinfo),])) +], + [], + [VTEP_CTL_CLEANUP]) + + dnl Check that each lrouter exists according to lr-exists and that + dnl a prouter that should not exist does not. + m4_foreach([lrinfo], [$@], + [AT_CHECK([RUN_VTEP_CTL([lr-exists m4_car(lrinfo)])], [0], [], + [], [VTEP_CTL_CLEANUP])]) + AT_CHECK([RUN_VTEP_CTL([lr-exists nonexistent])], [2], [], [], + [VTEP_CTL_CLEANUP])]) + + dnl ---------------------------------------------------------------------- AT_BANNER([vtep-ctl unit tests -- physical switch tests]) @@ -351,6 +384,60 @@ AT_CHECK([RUN_VTEP_CTL( VTEP_CTL_CLEANUP AT_CLEANUP + +dnl ---------------------------------------------------------------------- +AT_BANNER([vtep-ctl unit tests -- logical router tests]) + +AT_SETUP([add-lr a]) +AT_KEYWORDS([vtep-ctl]) +VTEP_CTL_SETUP +AT_CHECK([RUN_VTEP_CTL([add-lr a])], [0], [], [], [VTEP_CTL_CLEANUP]) +CHECK_LROUTERS([a]) +VTEP_CTL_CLEANUP +AT_CLEANUP + +AT_SETUP([add-lr a, add-lr a]) +AT_KEYWORDS([vtep-ctl]) +VTEP_CTL_SETUP +AT_CHECK([RUN_VTEP_CTL([add-lr a])], [0], [], [], [VTEP_CTL_CLEANUP]) +AT_CHECK([RUN_VTEP_CTL([add-lr a])], [1], [], + [vtep-ctl: cannot create logical router a because it already exists +], [VTEP_CTL_CLEANUP]) +VTEP_CTL_CLEANUP +AT_CLEANUP + +AT_SETUP([add-lr a, add-lr b]) +AT_KEYWORDS([vtep-ctl]) +VTEP_CTL_SETUP +AT_CHECK([RUN_VTEP_CTL([add-lr a], [add-lr b])], [0], [], [], + [VTEP_CTL_CLEANUP]) +CHECK_LROUTERS([a], [b]) +VTEP_CTL_CLEANUP +AT_CLEANUP + +AT_SETUP([add-lr a, add-lr b, del-lr a]) +AT_KEYWORDS([vtep-ctl]) +VTEP_CTL_SETUP +AT_CHECK([RUN_VTEP_CTL([add-lr a], [add-lr b], [del-lr a])], [0], [], [], + [VTEP_CTL_CLEANUP]) +CHECK_LROUTERS([b]) +VTEP_CTL_CLEANUP +AT_CLEANUP + +AT_SETUP([add-lr a, del-lr a, add-lr a]) +AT_KEYWORDS([vtep-ctl]) +VTEP_CTL_SETUP +AT_CHECK([RUN_VTEP_CTL_TOGETHER( + [add-lr a], + [del-lr a], + [add-lr a])], [0], [ + + +], [], [VTEP_CTL_CLEANUP]) +CHECK_LROUTERS([a]) +VTEP_CTL_CLEANUP +AT_CLEANUP + dnl ---------------------------------------------------------------------- AT_BANNER([vtep-ctl unit tests -- logical binding tests]) _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
