Skip to content

Commit

Permalink
Merge pull request #194 from crypticC0der/microcloudfix
Browse files Browse the repository at this point in the history
Add defaults for initial and and connect addresses
  • Loading branch information
mkalcok authored Oct 25, 2024
2 parents ea8393c + 126865e commit a314bc2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
16 changes: 16 additions & 0 deletions microovn/ovn/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ func generateEnvironment(ctx context.Context, s state.State) error {
localAddr = "[" + localAddr + "]"
}

//set northbound to be at the local address if there is no central db found
if nbInitial == "" {
nbInitial = localAddr
}
if nbConnect == "" {
nbConnect = "ssl:" + localAddr + ":6641"
}

//set southbound to be at the local address if there is no central db found
if sbInitial == "" {
sbInitial = localAddr
}
if sbConnect == "" {
sbConnect = "ssl:" + localAddr + ":6642"
}

err = ovnEnvTpl.Execute(fd, map[string]any{
"localAddr": localAddr,
"nbInitial": nbInitial,
Expand Down
24 changes: 23 additions & 1 deletion tests/test_helper/bats/cluster.bats
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ cluster_register_test_functions() {
bats_test_function \
--description "Open_vSwitch external_ids:ovn-remote addresses" \
-- cluster_ovs_ovn_remote_addresses
bats_test_function \
--description "Ensure northd connectivity between NB and SB" \
-- cluster_test_southbound_propagation
}

cluster_expected_count() {
Expand Down Expand Up @@ -165,7 +168,7 @@ cluster_ovs_ovn_remote_addresses() {
done
}

# _test_db_connection_string NBSB
# cluster_test_db_connection_string NBSB
#
# Tests that database connection string for NBSB contains the expected
# addresses.
Expand Down Expand Up @@ -208,4 +211,23 @@ cluster_test_db_connection_string() {
done
}

# cluster_test_southbound_propagation
#
# Tests that database connection between northbound and southbound databases
# is properly functional.
#
# The command tested is one which waits for the change to propagate to the
# southbound database and was specficially picked as it was at one point
# failing until pointed out by microcloud
cluster_test_southbound_propagation() {
for container in $TEST_CONTAINERS; do
run lxc_exec "$container" \
"microovn.ovn-nbctl --timeout=10 --wait=sb ha-chassis-group-add testnet"
assert_success
run lxc_exec "$container" \
"microovn.ovn-nbctl --timeout=10 --wait=sb ha-chassis-group-del testnet"
assert_success
done
}

cluster_register_test_functions

0 comments on commit a314bc2

Please sign in to comment.