Skip to content

Commit

Permalink
tests: fixed userspace-system tests not properly cleaned up
Browse files Browse the repository at this point in the history
Usually, when cleaning up a system test we execute (for the ovn-vswitchd process):
- OVS_TRAFFIC_VSWITCHD_STOP (i.e. ovs-appctl -t $1 exit --cleanup, wait up to 30 seconds
  and report failure if not properly cleaned up).
- kill_ovs_vswitchd (i.e. if ovs-vsitwhd still running,
  ovs-appctl -t ovs-vswitchd exit --cleanup, wait 1 to 10 seconds and kill ovs-vswitvchd
  if not properly cleaned up).

If we do not execute OVS_TRAFFIC_VSWITCHD_STOP, wait time is much smaller which might result in
- clean up not done properly, ovs-vswitchd killed, ovs-netdev not deleted, and no error reported
- next tests will fail

Using this patch, we properly execute OVS_TRAFFIC_VSWITCHD_STOP, so the delay waiting for
ovs-vswitchd to exit is longer, and, if by any chance this delay is still too short,
the proper test will fail (i.e. the first test failing will be the one unable to clean).

Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
Acked-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
(cherry picked from commit ee6d1ac)
  • Loading branch information
simonartxavier authored and dceara committed Jul 14, 2023
1 parent d62049f commit d95d150
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 5 deletions.
1 change: 1 addition & 0 deletions tests/ofproto-macros.at
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ check_logs () {
/timeval.*context switches: [[0-9]]* voluntary, [[0-9]]* involuntary/d
/ovs_rcu.*blocked [[0-9]]* ms waiting for .* to quiesce/d
/Dropped [[0-9]]* log messages/d
/.*Trying to release unknown interface.*/d
/|WARN|/p
/|ERR|/p
/|EMER|/p" ${logs}
Expand Down
2 changes: 1 addition & 1 deletion tests/system-common-macros.at
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ AT_CHECK([ovn-nbctl get logical_router_port rp-sw0 ipv6_prefix | cut -c3-16], [0
[]
])

kill $(pidof ovn-controller)
OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
Expand Down
103 changes: 99 additions & 4 deletions tests/system-ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -5819,6 +5819,21 @@ tcp,orig=(src=42.42.42.3,dst=42.42.42.2,sport=<clnt_s_port>,dport=4242),reply=(s
tcp,orig=(src=42.42.42.3,dst=66.66.66.66,sport=<clnt_s_port>,dport=666),reply=(src=42.42.42.2,dst=42.42.42.3,sport=4242,dport=<clnt_s_port>),zone=<cleared>,mark=2,protoinfo=(state=<cleared>)
])

OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as ovn-nb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])

as
OVS_TRAFFIC_VSWITCHD_STOP(["/failed to query port patch-.*/d
/connection dropped.*/d"])

AT_CLEANUP
])

Expand Down Expand Up @@ -5915,6 +5930,21 @@ tcp,orig=(src=4242::3,dst=4242::2,sport=<clnt_s_port>,dport=4242),reply=(src=424
tcp,orig=(src=4242::3,dst=6666::1,sport=<clnt_s_port>,dport=666),reply=(src=4242::2,dst=4242::3,sport=4242,dport=<clnt_s_port>),zone=<cleared>,mark=2,protoinfo=(state=<cleared>)
])

OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as ovn-nb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])

as
OVS_TRAFFIC_VSWITCHD_STOP(["/failed to query port patch-.*/d
/connection dropped.*/d"])

AT_CLEANUP
])

Expand Down Expand Up @@ -6716,7 +6746,7 @@ AT_CHECK([ovn-nbctl set Logical_Switch_Port sw02 options:qos_burst=1000000])
OVS_WAIT_UNTIL([tc class show dev ovs-public | \
grep -q 'class htb .* prio 0 rate 5Gbit ceil 6Gbit burst 125000b cburst 124500b'])

kill $(pidof ovn-controller)
OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
Expand Down Expand Up @@ -6867,7 +6897,7 @@ Allowing connections from 1000::a
wait_column "up" nb:bfd status logical_port=rp-public
ovn-nbctl destroy bfd $uuid_v6

kill $(pidof ovn-controller)
OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
Expand Down Expand Up @@ -7121,7 +7151,7 @@ NS_CHECK_EXEC([vm2], [ping -q -c 3 -i 0.3 -w 2 172.18.2.10 | FORMAT_PING], \
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])

kill $(pidof ovn-controller)
OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
Expand Down Expand Up @@ -7238,6 +7268,21 @@ NS_CHECK_EXEC([vm1], [ping -q -c 3 -i 0.3 -w 2 172.18.2.12 | FORMAT_PING], \
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])

OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as ovn-nb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])

as
OVS_TRAFFIC_VSWITCHD_STOP(["/failed to query port patch-.*/d
/connection dropped.*/d"])

AT_CLEANUP
])

Expand Down Expand Up @@ -7421,7 +7466,7 @@ OVS_WAIT_UNTIL([
])
kill $(pidof tcpdump)

kill $(pidof ovn-controller)
OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
Expand Down Expand Up @@ -8494,6 +8539,16 @@ tcp,orig=(src=192.168.2.2,dst=172.16.1.2,sport=<cleared>,dport=<cleared>),reply=
AT_CHECK([ovs-appctl dpctl/flush-conntrack])

OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as ovn-nb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])

as
OVS_TRAFFIC_VSWITCHD_STOP(["/failed to query port patch-.*/d
/connection dropped.*/d"])
Expand Down Expand Up @@ -8646,6 +8701,16 @@ NS_CHECK_EXEC([ls1p1], [ping6 -q -c 3 -i 0.3 -w 2 1711::1 | FORMAT_PING], \
])

OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as ovn-nb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])

as
OVS_TRAFFIC_VSWITCHD_STOP(["/failed to query port patch-.*/d
/connection dropped.*/d
Expand Down Expand Up @@ -9168,6 +9233,21 @@ OVS_WAIT_UNTIL([
test "${requests}" -ge "6"
])

OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as ovn-nb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])

as
OVS_TRAFFIC_VSWITCHD_STOP(["/failed to query port patch-.*/d
/connection dropped.*/d"])

AT_CLEANUP
])

Expand Down Expand Up @@ -9307,6 +9387,21 @@ OVS_WAIT_UNTIL([
test "${requests}" -ge "6"
])

OVS_APP_EXIT_AND_WAIT([ovn-controller])

as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as ovn-nb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])

as
OVS_TRAFFIC_VSWITCHD_STOP(["/failed to query port patch-.*/d
/connection dropped.*/d"])

AT_CLEANUP
])

Expand Down

0 comments on commit d95d150

Please sign in to comment.