remove time flaky time limited tests (#8522)
* remove flaky test. It isn't very useful anyway given that we're slowly adding retries to the checks for lockfiles * remove time-component from retry test; in underpowered CI builds, this can flake fairly often.
This commit is contained in:
parent
66445ecd2d
commit
127905e855
|
@ -33,14 +33,11 @@ func TestWaitForExpectedExceedRetryTimes(t *testing.T) {
|
|||
waitDone <- true
|
||||
}()
|
||||
|
||||
timeTolerance := 1 * time.Second
|
||||
select {
|
||||
case <-waitDone:
|
||||
if iter != defaultRetryTimes {
|
||||
t.Fatalf("WaitForExpected should terminate at the %d iterations", defaultRetryTimes)
|
||||
}
|
||||
case <-time.After(defaultRetryTimes*defaultRetryInterval + timeTolerance):
|
||||
t.Fatalf("WaitForExpected should terminate within %f seconds", (defaultRetryTimes*defaultRetryInterval + timeTolerance).Seconds())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,70 +109,6 @@ func TestStepShutdown_shutdownTimeout(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestStepShutdown_shutdownDelay(t *testing.T) {
|
||||
state := testState(t)
|
||||
step := new(StepShutdown)
|
||||
step.Command = "poweroff"
|
||||
step.Timeout = 5 * time.Second
|
||||
step.Delay = 2 * time.Second
|
||||
step.DisableShutdown = false
|
||||
|
||||
comm := new(packer.MockCommunicator)
|
||||
state.Put("communicator", comm)
|
||||
state.Put("vmName", "foo")
|
||||
|
||||
driver := state.Get("driver").(*DriverMock)
|
||||
driver.IsRunningReturn = true
|
||||
start := time.Now()
|
||||
|
||||
go func() {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
driver.Lock()
|
||||
defer driver.Unlock()
|
||||
driver.IsRunningReturn = false
|
||||
}()
|
||||
|
||||
// Test the run
|
||||
|
||||
if action := step.Run(context.Background(), state); action != multistep.ActionContinue {
|
||||
t.Fatalf("bad action: %#v", action)
|
||||
}
|
||||
testDuration := time.Since(start)
|
||||
if testDuration < 2500*time.Millisecond || testDuration > 2700*time.Millisecond {
|
||||
t.Fatalf("incorrect duration %s", testDuration)
|
||||
}
|
||||
|
||||
if _, ok := state.GetOk("error"); ok {
|
||||
t.Fatal("should NOT have error")
|
||||
}
|
||||
|
||||
step.Delay = 0
|
||||
|
||||
driver.IsRunningReturn = true
|
||||
start = time.Now()
|
||||
|
||||
go func() {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
driver.Lock()
|
||||
defer driver.Unlock()
|
||||
driver.IsRunningReturn = false
|
||||
}()
|
||||
|
||||
// Test the run
|
||||
if action := step.Run(context.Background(), state); action != multistep.ActionContinue {
|
||||
t.Fatalf("bad action: %#v", action)
|
||||
}
|
||||
testDuration = time.Since(start)
|
||||
if testDuration > 700*time.Millisecond {
|
||||
t.Fatalf("incorrect duration %s", testDuration)
|
||||
}
|
||||
|
||||
if _, ok := state.GetOk("error"); ok {
|
||||
t.Fatal("should NOT have error")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestStepShutdown_DisableShutdown(t *testing.T) {
|
||||
state := testState(t)
|
||||
step := new(StepShutdown)
|
||||
|
|
Loading…
Reference in New Issue