From 8bab9dc3c04f8a9a8bc6dc7cd526fc557f237485 Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Wed, 31 Jul 2024 01:24:02 +0300 Subject: [PATCH] fix tests --- management/server/account_test.go | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/management/server/account_test.go b/management/server/account_test.go index 34532937b..a2c2514f4 100644 --- a/management/server/account_test.go +++ b/management/server/account_test.go @@ -1111,15 +1111,31 @@ func TestAccountManager_AddPeerWithUserID(t *testing.T) { func TestAccountManager_NetworkUpdates_SaveGroup(t *testing.T) { manager, account, peer1, peer2, peer3 := setupNetworkMapTest(t) - updMsg := manager.peersUpdateManager.CreateChannel(context.Background(), peer1.ID) - defer manager.peersUpdateManager.CloseChannel(context.Background(), peer1.ID) - group := group.Group{ ID: "group-id", Name: "GroupA", Peers: []string{peer1.ID, peer2.ID, peer3.ID}, } + policy := Policy{ + ID: "policy", + Enabled: true, + Rules: []*PolicyRule{ + { + Enabled: true, + Sources: []string{"group-id"}, + Destinations: []string{"group-id"}, + Bidirectional: true, + Action: PolicyTrafficActionAccept, + }, + }, + } + err := manager.SavePolicy(context.Background(), account.Id, userID, &policy) + require.NoError(t, err) + + updMsg := manager.peersUpdateManager.CreateChannel(context.Background(), peer1.ID) + defer manager.peersUpdateManager.CloseChannel(context.Background(), peer1.ID) + wg := sync.WaitGroup{} wg.Add(1) go func() {