From 6c633497bc84c19f452bf8d230901f1f2dabcd6b Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Wed, 2 Jul 2025 12:25:31 +0200 Subject: [PATCH] [management] fix network update test for delete policy (#4086) when adding a peer we calculate the network map an account using backpressure functions and some updates might arrive around the time we are deleting a policy. This change ensures we wait enough time for the updates from add peer to be sent and read before continuing with the test logic --- management/server/account_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/management/server/account_test.go b/management/server/account_test.go index 49fcedd56..7f319b81e 100644 --- a/management/server/account_test.go +++ b/management/server/account_test.go @@ -1208,6 +1208,14 @@ func TestAccountManager_NetworkUpdates_DeletePolicy(t *testing.T) { updMsg := manager.peersUpdateManager.CreateChannel(context.Background(), peer1.ID) defer manager.peersUpdateManager.CloseChannel(context.Background(), peer1.ID) + // Ensure that we do not receive an update message before the policy is deleted + time.Sleep(time.Second) + select { + case <-updMsg: + t.Logf("received addPeer update message before policy deletion") + default: + } + wg := sync.WaitGroup{} wg.Add(1) go func() {