tests: restart restartpolicy for all tasks in tests
This commit is contained in:
parent
2698056311
commit
a5b024fdea
|
@ -236,9 +236,9 @@ func TestAllocRunner_PreStartFailuresLeadToFailed(t *testing.T) {
|
|||
task.Config = map[string]interface{}{
|
||||
"run_for": "2ms",
|
||||
}
|
||||
alloc.Job.TaskGroups[0].RestartPolicy = &structs.RestartPolicy{
|
||||
Attempts: 0,
|
||||
}
|
||||
rp := &structs.RestartPolicy{Attempts: 0}
|
||||
alloc.Job.TaskGroups[0].RestartPolicy = rp
|
||||
task.RestartPolicy = rp
|
||||
|
||||
conf, cleanup := testAllocRunnerConfig(t, alloc.Copy())
|
||||
defer cleanup()
|
||||
|
|
|
@ -1502,6 +1502,7 @@ func TestTaskRunner_Download_ChrootExec(t *testing.T) {
|
|||
alloc := mock.BatchAlloc()
|
||||
alloc.Job.TaskGroups[0].RestartPolicy = &structs.RestartPolicy{}
|
||||
task := alloc.Job.TaskGroups[0].Tasks[0]
|
||||
task.RestartPolicy = &structs.RestartPolicy{}
|
||||
task.Driver = "exec"
|
||||
task.Config = map[string]interface{}{
|
||||
"command": "noop.sh",
|
||||
|
@ -1541,6 +1542,7 @@ func TestTaskRunner_Download_RawExec(t *testing.T) {
|
|||
alloc := mock.BatchAlloc()
|
||||
alloc.Job.TaskGroups[0].RestartPolicy = &structs.RestartPolicy{}
|
||||
task := alloc.Job.TaskGroups[0].Tasks[0]
|
||||
task.RestartPolicy = &structs.RestartPolicy{}
|
||||
task.Driver = "raw_exec"
|
||||
task.Config = map[string]interface{}{
|
||||
"command": "noop.sh",
|
||||
|
@ -1631,12 +1633,14 @@ func TestTaskRunner_Download_Retries(t *testing.T) {
|
|||
task.Artifacts = []*structs.TaskArtifact{&artifact}
|
||||
|
||||
// Make the restart policy retry once
|
||||
alloc.Job.TaskGroups[0].RestartPolicy = &structs.RestartPolicy{
|
||||
rp := &structs.RestartPolicy{
|
||||
Attempts: 1,
|
||||
Interval: 10 * time.Minute,
|
||||
Delay: 1 * time.Second,
|
||||
Mode: structs.RestartPolicyModeFail,
|
||||
}
|
||||
alloc.Job.TaskGroups[0].RestartPolicy = rp
|
||||
alloc.Job.TaskGroups[0].Tasks[0].RestartPolicy = rp
|
||||
|
||||
tr, _, cleanup := runTestTaskRunner(t, alloc, task.Name)
|
||||
defer cleanup()
|
||||
|
@ -1873,12 +1877,14 @@ func TestTaskRunner_Run_RecoverableStartError(t *testing.T) {
|
|||
}
|
||||
|
||||
// Make the restart policy retry once
|
||||
alloc.Job.TaskGroups[0].RestartPolicy = &structs.RestartPolicy{
|
||||
rp := &structs.RestartPolicy{
|
||||
Attempts: 1,
|
||||
Interval: 10 * time.Minute,
|
||||
Delay: 0,
|
||||
Mode: structs.RestartPolicyModeFail,
|
||||
}
|
||||
alloc.Job.TaskGroups[0].RestartPolicy = rp
|
||||
alloc.Job.TaskGroups[0].Tasks[0].RestartPolicy = rp
|
||||
|
||||
tr, _, cleanup := runTestTaskRunner(t, alloc, task.Name)
|
||||
defer cleanup()
|
||||
|
|
Loading…
Reference in New Issue