mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
fix test race in schedule mock (#10309)
This fixes the races that are occurring on tests ([example](https://github.com/fleetdm/fleet/actions/runs/4339799935))
This commit is contained in:
parent
b8fa08b53c
commit
aa7466b819
@ -506,7 +506,7 @@ func TestTriggerReleaseLock(t *testing.T) {
|
||||
require.Equal(t, seedStats, statsByType[fleet.CronStatsTypeScheduled])
|
||||
}
|
||||
|
||||
require.True(t, locker.expiresAt.Before(time.Now()))
|
||||
require.True(t, locker.GetExpiration().Before(time.Now()))
|
||||
}
|
||||
|
||||
func TestMultipleScheduleInstancesConfigChangesDS(t *testing.T) {
|
||||
|
@ -99,6 +99,13 @@ func (ml *MockLock) GetLockCount() int {
|
||||
return ml.LockCount
|
||||
}
|
||||
|
||||
func (ml *MockLock) GetExpiration() time.Time {
|
||||
ml.mu.Lock()
|
||||
defer ml.mu.Unlock()
|
||||
|
||||
return ml.expiresAt
|
||||
}
|
||||
|
||||
func (ml *MockLock) AddChannels(t *testing.T, chanNames ...string) error {
|
||||
ml.mu.Lock()
|
||||
defer ml.mu.Unlock()
|
||||
|
Loading…
Reference in New Issue
Block a user