Merge pull request #1490 from nak3/fix-gofmt
Fix gofmt in restarts_test.go
This commit is contained in:
commit
7c57ba286f
|
@ -116,26 +116,26 @@ func TestClient_RestartTracker_StartError_Recoverable_Fail(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestClient_RestartTracker_StartError_Recoverable_Delay(t *testing.T) {
|
||||
t.Parallel()
|
||||
p := testPolicy(true, structs.RestartPolicyModeDelay)
|
||||
rt := newRestartTracker(p, structs.JobTypeSystem)
|
||||
recErr := cstructs.NewRecoverableError(fmt.Errorf("foo"), true)
|
||||
for i := 0; i < p.Attempts; i++ {
|
||||
state, when := rt.SetStartError(recErr).GetState()
|
||||
if state != structs.TaskRestarting {
|
||||
t.Fatalf("NextRestart() returned %v, want %v", state, structs.TaskRestarting)
|
||||
}
|
||||
if !withinJitter(p.Delay, when) {
|
||||
t.Fatalf("NextRestart() returned %v; want %v+jitter", when, p.Delay)
|
||||
}
|
||||
}
|
||||
t.Parallel()
|
||||
p := testPolicy(true, structs.RestartPolicyModeDelay)
|
||||
rt := newRestartTracker(p, structs.JobTypeSystem)
|
||||
recErr := cstructs.NewRecoverableError(fmt.Errorf("foo"), true)
|
||||
for i := 0; i < p.Attempts; i++ {
|
||||
state, when := rt.SetStartError(recErr).GetState()
|
||||
if state != structs.TaskRestarting {
|
||||
t.Fatalf("NextRestart() returned %v, want %v", state, structs.TaskRestarting)
|
||||
}
|
||||
if !withinJitter(p.Delay, when) {
|
||||
t.Fatalf("NextRestart() returned %v; want %v+jitter", when, p.Delay)
|
||||
}
|
||||
}
|
||||
|
||||
// Next restart should cause delay
|
||||
state, when := rt.SetStartError(recErr).GetState()
|
||||
if state != structs.TaskRestarting {
|
||||
t.Fatalf("NextRestart() returned %v; want %v", state, structs.TaskRestarting)
|
||||
}
|
||||
if !(when > p.Delay && when <= p.Interval) {
|
||||
t.Fatalf("NextRestart() returned %v; want > %v and <= %v", when, p.Delay, p.Interval)
|
||||
}
|
||||
// Next restart should cause delay
|
||||
state, when := rt.SetStartError(recErr).GetState()
|
||||
if state != structs.TaskRestarting {
|
||||
t.Fatalf("NextRestart() returned %v; want %v", state, structs.TaskRestarting)
|
||||
}
|
||||
if !(when > p.Delay && when <= p.Interval) {
|
||||
t.Fatalf("NextRestart() returned %v; want > %v and <= %v", when, p.Delay, p.Interval)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue