mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
Fix data race with push notification in test (#27682)
Fix for https://github.com/fleetdm/fleet/actions/runs/14098566529/job/39490440108
This commit is contained in:
parent
8fa88fdec0
commit
888e4a6a7f
1 changed files with 8 additions and 0 deletions
|
|
@ -15311,14 +15311,22 @@ func (s *integrationMDMTestSuite) TestRecreateDeletedIPhoneBYOD() {
|
|||
require.Len(t, listHostsRes.Hosts, 0)
|
||||
|
||||
// run the reviver cron job, will send a push notification to the deleted host
|
||||
oriPushFunc := s.pushProvider.PushFunc
|
||||
t.Cleanup(func() { s.pushProvider.PushFunc = oriPushFunc })
|
||||
|
||||
var recordedPushes []*mdm.Push
|
||||
var pushMutex sync.Mutex
|
||||
s.pushProvider.PushFunc = func(ctx context.Context, pushes []*mdm.Push) (map[string]*push.Response, error) {
|
||||
pushMutex.Lock()
|
||||
recordedPushes = pushes
|
||||
pushMutex.Unlock()
|
||||
return mockSuccessfulPush(ctx, pushes)
|
||||
}
|
||||
err := apple_mdm.IOSiPadOSRevive(context.Background(), s.ds, s.mdmCommander, s.logger)
|
||||
require.NoError(t, err)
|
||||
pushMutex.Lock()
|
||||
require.Len(t, recordedPushes, 1)
|
||||
pushMutex.Unlock()
|
||||
|
||||
// do an MDM sync (as the host would when triggered by the notification),
|
||||
// will re-create the host and move it to its enrollment team
|
||||
|
|
|
|||
Loading…
Reference in a new issue