Skip to content

Commit

Permalink
Fix small test suite issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsastrix committed Mar 11, 2024
1 parent a8bbc2f commit 4548069
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions management/server/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,16 @@ func TestDefaultAccountManager_GroupIPv6Consistency(t *testing.T) {
require.NotNil(t, account.Peers[peer2Id].IP6, "peer2 should have an IPv6 address as it is a member of the IPv6-enabled group.")

// Force disable IPv6.
account.GetPeer(peer1Id).V6Setting = nbpeer.V6Disabled
account.GetPeer(peer2Id).V6Setting = nbpeer.V6Disabled
account.UpdatePeer(account.Peers[peer1Id])
account.UpdatePeer(account.Peers[peer2Id])
err = am.Store.SaveAccount(account)
require.NoError(t, err, "unable to update account")
peer1 := account.GetPeer(peer1Id)
peer2 := account.GetPeer(peer2Id)
peer1.V6Setting = nbpeer.V6Disabled
peer2.V6Setting = nbpeer.V6Disabled
_, err = am.UpdatePeer(account.Id, groupAdminUserID, peer1)
require.NoError(t, err, "unable to update peer1")
_, err = am.UpdatePeer(account.Id, groupAdminUserID, peer2)
require.NoError(t, err, "unable to update peer2")
account, err = am.Store.GetAccount(account.Id)
require.NoError(t, err, "unable to update account")
require.NoError(t, err, "unable to fetch updated account")
group = account.GetGroup("grp-for-ipv6")
require.Nil(t, account.GetPeer(peer1Id).IP6, "peer1 should not have an IPv6 address as it is force disabled.")
require.Nil(t, account.GetPeer(peer2Id).IP6, "peer2 should not have an IPv6 address as it is force disabled.")
Expand Down
2 changes: 1 addition & 1 deletion management/server/peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func TestDefaultAccountManager_DeterminePeerV6(t *testing.T) {
_, err = manager.DeterminePeerV6(account, peer1)
require.NoError(t, err, "unable to determine effective peer IPv6 status")
_, err = manager.DeterminePeerV6(account, peer2)
require.NoError(t, err, "unable to determine effective peer IPv6 status")
require.Error(t, err, "determining peer2 IPv6 address should fail as it is force enabled, but unsupported.")
require.NotNil(t, peer1.IP6, "peer1 IPv6 address is nil even though it is force enabled.")
require.Nil(t, peer2.IP6, "peer2 IPv6 address is not nil even though it is unsupported.")

Expand Down

0 comments on commit 4548069

Please sign in to comment.