Skip to content

Commit

Permalink
Extend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
surik committed Sep 15, 2023
1 parent 29fcdbb commit 0fcab38
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion management/server/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,32 @@ func TestGetNetworkMap_RouteSyncPeersGroup(t *testing.T) {
require.NoError(t, err)
require.Len(t, peer2Routes.Routes, 2, "HA route should have more than 1 peer")

//TODO(yury): test adding peer to the group. route should have that peer
groups, err := am.ListGroups(account.Id)
require.NoError(t, err)
var groupHA *Group
for _, group := range groups {
if group.Name == routeGroupHA {
groupHA = group
break
}
}
err = am.GroupDeletePeer(account.Id, groupHA.ID, peer1Key)
require.NoError(t, err)

peer2RoutesAfterDelete, err := am.GetNetworkMap(peer2ID)
require.NoError(t, err)
require.Len(t, peer2RoutesAfterDelete.Routes, 1, "after peer deletion group should have only 1 peer")

err = am.GroupAddPeer(account.Id, groupHA.ID, peer1ID)
require.NoError(t, err)

peer1RoutesAfterAdd, err := am.GetNetworkMap(peer1ID)
require.NoError(t, err)
require.Len(t, peer1RoutesAfterAdd.Routes, 2, "HA route should have more than 1 peer")

peer2RoutesAfterAdd, err := am.GetNetworkMap(peer2ID)
require.NoError(t, err)
require.Len(t, peer2RoutesAfterAdd.Routes, 2, "HA route should have more than 1 peer")

err = am.DeleteRoute(account.Id, newRoute.ID, userID)
require.NoError(t, err)
Expand Down

0 comments on commit 0fcab38

Please sign in to comment.