Skip to content

Commit

Permalink
tests: do not start backup-northd by default
Browse files Browse the repository at this point in the history
Tests were (usually) starting both northd and northd-backup, but the start procedure
did not control which one was active.

Most tests did not expect backup-northd to be running.
- Either the test completely ignore the fact that backup northd might be running.
  In such a case, having backup-northd might hide a northd crash.
- Some tests expects northd.log (and not northd-backup.log) to contain some
  specific strings. Having northd-backup running makes such tests to fail
  flakily.

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 c12d246)
  • Loading branch information
simonartxavier authored and dceara committed Nov 17, 2023
1 parent a142214 commit 54fae8c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 32 deletions.
3 changes: 0 additions & 3 deletions tests/ovn-controller-vtep.at
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,6 @@ AT_CHECK([grep -c $northd_version vtep1/ovn-controller-vtep.log], [0], [1
as northd
OVS_APP_EXIT_AND_WAIT([ovn-northd])

as northd-backup
OVS_APP_EXIT_AND_WAIT([ovn-northd])

check ovn-sbctl set SB_Global . options:northd_internal_version=foo
check ovn-sbctl set Chassis vtep1 vtep_logical_switches=foo

Expand Down
6 changes: 1 addition & 5 deletions tests/ovn-controller.at
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ check_bridge_mappings () {
# the RBAC rules programmed into the SB-DB. The test instruments the SB-DB
# directly and we need to stop northd to avoid overwriting the instrumentation.
kill `cat northd/ovn-northd.pid`
kill `cat northd-backup/ovn-northd.pid`
kill `cat ovn-nb/ovsdb-server.pid`

# Initially there should be no patch ports.
Expand Down Expand Up @@ -579,10 +578,8 @@ localport lport : [[lsp1]]

# pause ovn-northd
check as northd ovn-appctl -t ovn-northd pause
check as northd-backup ovn-appctl -t ovn-northd pause

as northd ovn-appctl -t ovn-northd status
as northd-backup ovn-appctl -t ovn-northd status

pb_types=(patch chassisredirect l3gateway localnet localport l2gateway
virtual external remote vtep)
Expand Down Expand Up @@ -2097,7 +2094,6 @@ AT_CHECK([ovs-ofctl dump-flows br-int table=46 | grep -c "priority=1100"], [0],

# pause ovn-northd
check as northd ovn-appctl -t ovn-northd pause
check as northd-backup ovn-appctl -t ovn-northd pause

# Simulate a SB address set "del and add" notification to ovn-controller in the
# same IDL iteration. The flows programmed by ovn-controller should reflect the
Expand All @@ -2122,7 +2118,7 @@ AT_CLEANUP

AT_SETUP([ovn-controller - I-P handle lb_hairpin_use_ct_mark change])

ovn_start --backup-northd=none
ovn_start

net_add n1
sim_add hv1
Expand Down
10 changes: 5 additions & 5 deletions tests/ovn-macros.at
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,16 @@ ovn_start_northd() {
# ovn-sbctl and ovn-nbctl use them by default, and starts ovn-northd running
# against them.
#
# Normally this starts an active northd and a backup northd. The following
# Normally this starts only an active northd and no backup northd. The following
# options are accepted to adjust that:
# --backup-northd=none Don't start a backup northd.
# --backup-northd Start a backup northd.
# --backup-northd=paused Start the backup northd in the paused state.
ovn_start () {
local backup_northd=:
local backup_northd=false
local backup_northd_options=
case $1 in
--backup-northd=none) backup_northd=false; shift ;;
--backup-northd=paused) backup_northd_options=--paused; shift ;;
--backup-northd) backup_northd=true; shift ;;
--backup-northd=paused) backup_northd=true; backup_northd_options=--paused; shift ;;
esac
local AZ=$1
local msg_prefix=${AZ:+$AZ: }
Expand Down
11 changes: 5 additions & 6 deletions tests/ovn-northd.at
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ AT_CLEANUP

OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([ovn-northd restart])
ovn_start --backup-northd=none
ovn_start

# Check that ovn-northd is active, by verifying that it creates and
# destroys southbound datapaths as one would expect.
Expand All @@ -832,7 +832,7 @@ sleep 5
check_row_count Datapath_Binding 1

# Now resume ovn-northd. Changes should catch up.
ovn_start_northd primary
ovn_start_northd
wait_row_count Datapath_Binding 2

AT_CLEANUP
Expand All @@ -841,7 +841,7 @@ AT_CLEANUP
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([northbound database reconnection])

ovn_start --backup-northd=none
ovn_start

# Check that ovn-northd is active, by verifying that it creates and
# destroys southbound datapaths as one would expect.
Expand Down Expand Up @@ -873,7 +873,7 @@ AT_CLEANUP
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([southbound database reconnection])

ovn_start --backup-northd=none
ovn_start

# Check that ovn-northd is active, by verifying that it creates and
# destroys southbound datapaths as one would expect.
Expand Down Expand Up @@ -4611,7 +4611,7 @@ AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
PKIDIR="$(cd $abs_top_builddir/tests && pwd)"
AT_SKIP_IF([expr "$PKIDIR" : ".*[[ '\"
\\]]"])
ovn_start --backup-northd=none
ovn_start

as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])
Expand Down Expand Up @@ -9001,7 +9001,6 @@ grep -c mutate], [0], [2
# Pause ovn-northd and add/remove few addresses. when it is resumed
# it should use mutate for updating the address sets.
check as northd ovn-appctl -t NORTHD_TYPE pause
check as northd-backup ovn-appctl -t NORTHD_TYPE pause

check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats
check ovn-nbctl add address_set $foo_as_uuid addresses 1.1.1.5
Expand Down
13 changes: 0 additions & 13 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -7174,9 +7174,6 @@ compare_dhcp_packets 1
as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])

as northd-backup
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])

northd_version=$(ovn-sbctl get SB_Global . options:northd_internal_version | sed s/\"//g)
echo "northd version = $northd_version"

Expand Down Expand Up @@ -30643,7 +30640,6 @@ check ovn-nbctl --wait=hv ls-lb-del sw0 lb-ipv6
# original destination tuple.
#
# ovn-controller should fall back to matching on ct_nw_dst()/ct_tp_dst().
as northd-backup ovn-appctl -t NORTHD_TYPE pause
as northd ovn-appctl -t NORTHD_TYPE pause

check ovn-sbctl \
Expand Down Expand Up @@ -30694,7 +30690,6 @@ OVS_WAIT_FOR_OUTPUT([as hv2 ovs-ofctl dump-flows br-int table=70 | ofctl_strip_a

# Resume ovn-northd.
as northd ovn-appctl -t NORTHD_TYPE resume
as northd-backup ovn-appctl -t NORTHD_TYPE resume
check ovn-nbctl --wait=hv sync

as hv2 ovs-vsctl del-port hv2-vif1
Expand Down Expand Up @@ -30815,9 +30810,6 @@ AT_CHECK([grep -c $northd_version hv1/ovn-controller.log], [0], [1
as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])

as northd-backup
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])

check ovn-sbctl set SB_Global . options:northd_internal_version=foo

as hv1
Expand Down Expand Up @@ -30959,7 +30951,6 @@ AS_BOX([ovn-controller should not reset Port_Binding.up without northd])
# Pause northd and clear the "up" field to simulate older ovn-northd
# versions writing to the Southbound DB.
as northd ovn-appctl -t NORTHD_TYPE pause
as northd-backup ovn-appctl -t NORTHD_TYPE pause

as hv1 ovn-appctl -t ovn-controller debug/pause
check ovn-sbctl clear Port_Binding lsp1 up
Expand All @@ -30975,7 +30966,6 @@ check_column "" Port_Binding up logical_port=lsp1
# Once northd should explicitly set the Port_Binding.up field to 'false' and
# ovn-controller sets it to 'true' as soon as the update is processed.
as northd ovn-appctl -t NORTHD_TYPE resume
as northd-backup ovn-appctl -t NORTHD_TYPE resume
wait_column "true" Port_Binding up logical_port=lsp1
wait_column "true" nb:Logical_Switch_Port up name=lsp1

Expand Down Expand Up @@ -31130,7 +31120,6 @@ check ovn-nbctl lsp-set-addresses sw0-p4 "00:00:00:00:00:04 192.168.47.4"
# will be sent in one transaction.

check as northd ovn-appctl -t NORTHD_TYPE pause
check as northd-backup ovn-appctl -t NORTHD_TYPE pause

check ovn-nbctl lsp-add sw0 sw0-p1
check ovn-nbctl lsp-set-addresses sw0-p1 "00:00:00:00:00:01 192.168.47.1"
Expand Down Expand Up @@ -33581,7 +33570,6 @@ check as hv1 ovn-appctl -t ovn-controller exit

# Pause northd to guarantee that ovn-controller starts before requested_chassis
# column is filled.
check as northd-backup ovn-appctl -t ovn-northd pause
check as northd ovn-appctl -t ovn-northd pause

# Wait until requested_chassis is empty
Expand All @@ -33595,7 +33583,6 @@ wait_column "hv1" Chassis name

# Start northd and wait for events to be processed
check as northd ovn-appctl -t ovn-northd resume
check as northd-backup ovn-appctl -t ovn-northd resume

wait_for_ports_up lsp1

Expand Down

0 comments on commit 54fae8c

Please sign in to comment.