Fix flaky TestLifecycleSCEPExpiration test. (#23534)

#20936

# Checklist for submitter
- [x] Added/updated tests
This commit is contained in:
Victor Lyuboslavsky
2024-11-05 12:06:21 -06:00
committed by GitHub
parent 3cf99f8039
commit 5eb88d13ce
2 changed files with 19 additions and 9 deletions
@@ -590,8 +590,13 @@ func (s *integrationMDMTestSuite) setupLifecycleSettings() {
// Host is renewing SCEP certificates
func (s *integrationMDMTestSuite) TestLifecycleSCEPCertExpiration() {
t := s.T()
t.Skip("flaky test, see https://github.com/fleetdm/fleet/issues/20936")
ctx := context.Background()
// Skip worker jobs to avoid running into timing issues with this test.
// We can manually run the jobs if needed with s.runWorker().
s.skipWorkerJobs = true
t.Cleanup(func() { s.skipWorkerJobs = false })
// ensure there's a token for automatic enrollments
s.enableABM(t.Name())
s.runDEPSchedule()
+13 -8
View File
@@ -97,14 +97,16 @@ type integrationMDMTestSuite struct {
onIntegrationsScheduleDone func() // function called when integrationsSchedule.Trigger() job completed
mdmStorage *mysql.NanoMDMStorage
worker *worker.Worker
mdmCommander *apple_mdm.MDMAppleCommander
logger kitlog.Logger
scepChallenge string
appleVPPConfigSrv *httptest.Server
appleVPPConfigSrvConfig *appleVPPConfigSrvConf
appleITunesSrv *httptest.Server
appleGDMFSrv *httptest.Server
mockedDownloadFleetdmMeta fleetdbase.Metadata
// Flag to skip jobs processing by worker
skipWorkerJobs bool
mdmCommander *apple_mdm.MDMAppleCommander
logger kitlog.Logger
scepChallenge string
appleVPPConfigSrv *httptest.Server
appleVPPConfigSrvConfig *appleVPPConfigSrvConf
appleITunesSrv *httptest.Server
appleGDMFSrv *httptest.Server
mockedDownloadFleetdmMeta fleetdbase.Metadata
}
// appleVPPConfigSrvConf is used to configure the mock server that mocks Apple's VPP endpoints.
@@ -261,6 +263,9 @@ func (s *integrationMDMTestSuite) SetupSuite() {
ctx, name, s.T().Name(), 1*time.Minute, ds, ds,
schedule.WithLogger(logger),
schedule.WithJob("integrations_worker", func(ctx context.Context) error {
if s.skipWorkerJobs {
return nil
}
return s.worker.ProcessJobs(ctx)
}),
schedule.WithJob("dep_cooldowns", func(ctx context.Context) error {