diff --git a/.circleci/config.yml b/.circleci/config.yml index 2175d74d2..6372c9267 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,6 +13,7 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -97,6 +98,7 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -181,6 +183,7 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -265,6 +268,7 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -349,6 +353,7 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -480,6 +485,7 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -519,6 +525,7 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -602,6 +609,7 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -695,6 +703,7 @@ jobs: - GOLANG_VERSION: 1.14 - GOMAXPROCS: 1 - GOPATH: /Users/distiller/go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -707,6 +716,7 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -790,6 +800,7 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -839,6 +850,7 @@ jobs: - GIT_PAGER: cat - GOMAXPROCS: 1 - GOPATH: /go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat @@ -851,6 +863,7 @@ jobs: - GOLANG_VERSION: 1.14.1 - GOMAXPROCS: 1 - GOPATH: /home/circleci/go + - GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat diff --git a/.circleci/config/config.yml b/.circleci/config/config.yml index bb98e74fa..45de96c04 100644 --- a/.circleci/config/config.yml +++ b/.circleci/config/config.yml @@ -12,6 +12,7 @@ references: GOMAXPROCS: 1 NOMAD_SLOW_TEST: 1 GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + GOTESTSUM_JSONFILE: /tmp/test-reports/testjsonfile.json # disable implicit git paging. CircleCI runs commands with in a tty # making git assume it's an interactive session. PAGER: cat diff --git a/client/allocrunner/alloc_runner_unix_test.go b/client/allocrunner/alloc_runner_unix_test.go index 7cc830510..7ec4dea0b 100644 --- a/client/allocrunner/alloc_runner_unix_test.go +++ b/client/allocrunner/alloc_runner_unix_test.go @@ -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() diff --git a/client/allocrunner/taskrunner/task_runner_test.go b/client/allocrunner/taskrunner/task_runner_test.go index f9dc21829..fd9c4f113 100644 --- a/client/allocrunner/taskrunner/task_runner_test.go +++ b/client/allocrunner/taskrunner/task_runner_test.go @@ -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() @@ -2245,13 +2251,15 @@ func TestTaskRunner_UnregisterConsul_Retries(t *testing.T) { alloc := mock.Alloc() // Make the restart policy try one ctx.update - alloc.Job.TaskGroups[0].RestartPolicy = &structs.RestartPolicy{ + rp := &structs.RestartPolicy{ Attempts: 1, Interval: 10 * time.Minute, Delay: time.Nanosecond, Mode: structs.RestartPolicyModeFail, } + alloc.Job.TaskGroups[0].RestartPolicy = rp task := alloc.Job.TaskGroups[0].Tasks[0] + task.RestartPolicy = rp task.Driver = "mock_driver" task.Config = map[string]interface{}{ "exit_code": "1",