Skip to content

Commit

Permalink
improve test check to account for apstra-assigned value
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismarget-j committed Oct 25, 2024
1 parent 35a52b7 commit c6a81f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apstra/two_stage_l3_clos_virtual_networks_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ func compareSviIpSlices(t *testing.T, a, b []SviIp) {
}

func compareVnBindings(t *testing.T, a, b VnBinding, strict bool) {
compareSlices(t, a.AccessSwitchNodeIds, b.AccessSwitchNodeIds, "VnBindings.AccessSwitchNodeIds")
if len(a.AccessSwitchNodeIds) != 0 || len(b.AccessSwitchNodeIds) != 0 { // nil and [] slices are equal for our purpose
compareSlices(t, a.AccessSwitchNodeIds, b.AccessSwitchNodeIds, "VnBindings.AccessSwitchNodeIds")
}

require.Equal(t, a.SystemId, b.SystemId)

if a.VlanId != nil || b.VlanId != nil {
if a.VlanId != nil || // the caller specified a VLAN, so we check it
((a.VlanId != nil || b.VlanId != nil) && strict) { // strict mode means we always check
require.NotNil(t, a.VlanId)
require.NotNil(t, b.VlanId)
require.Equal(t, a.VlanId, b.VlanId)
Expand Down

0 comments on commit c6a81f8

Please sign in to comment.