diff --git a/client/driver/driver_test.go b/client/driver/driver_test.go index 9bda35f0d..53d839e95 100644 --- a/client/driver/driver_test.go +++ b/client/driver/driver_test.go @@ -206,6 +206,7 @@ func setupTaskEnv(t *testing.T, driver string) (*allocdir.TaskDir, map[string]st "HELLO": "world", "lorem": "ipsum", "NOMAD_ALLOC_ID": alloc.ID, + "NOMAD_ALLOC_INDEX": "0", "NOMAD_ALLOC_NAME": alloc.Name, "NOMAD_TASK_NAME": task.Name, "NOMAD_JOB_NAME": alloc.Job.Name, diff --git a/client/driver/env/env_test.go b/client/driver/env/env_test.go index 7846ad4e8..ce5262ebd 100644 --- a/client/driver/env/env_test.go +++ b/client/driver/env/env_test.go @@ -203,6 +203,7 @@ func TestEnvironment_AsList(t *testing.T) { "NOMAD_META_owner=armon", "NOMAD_JOB_NAME=my-job", fmt.Sprintf("NOMAD_ALLOC_ID=%s", a.ID), + "NOMAD_ALLOC_INDEX=0", } sort.Strings(act) sort.Strings(exp) diff --git a/command/agent/job_endpoint_test.go b/command/agent/job_endpoint_test.go index 5488e9568..173da2acb 100644 --- a/command/agent/job_endpoint_test.go +++ b/command/agent/job_endpoint_test.go @@ -965,7 +965,7 @@ func TestHTTP_JobStable(t *testing.T) { // Check the response stableResp := obj.(structs.JobStabilityResponse) - if stableResp.JobModifyIndex == 0 { + if stableResp.Index == 0 { t.Fatalf("bad: %v", stableResp) } diff --git a/command/deployment_promote_test.go b/command/deployment_promote_test.go index b3ce0c85a..c05390d6c 100644 --- a/command/deployment_promote_test.go +++ b/command/deployment_promote_test.go @@ -27,6 +27,14 @@ func TestDeploymentPromoteCommand_Fails(t *testing.T) { if code := cmd.Run([]string{"-address=nope", "12"}); code != 1 { t.Fatalf("expected exit code 1, got: %d", code) } + if out := ui.ErrorWriter.String(); !strings.Contains(out, "flags must be specified") { + t.Fatalf("expected missing flags error, got: %s", out) + } + ui.ErrorWriter.Reset() + + if code := cmd.Run([]string{"-address=nope", "-all", "12"}); code != 1 { + t.Fatalf("expected exit code 1, got: %d", code) + } if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error retrieving deployment") { t.Fatalf("expected failed query error, got: %s", out) } diff --git a/command/node_status_test.go b/command/node_status_test.go index 0b5f398e4..3fba4c88c 100644 --- a/command/node_status_test.go +++ b/command/node_status_test.go @@ -48,7 +48,7 @@ func TestNodeStatusCommand_Self(t *testing.T) { if !strings.Contains(out, "mynode") { t.Fatalf("expect to find mynode, got: %s", out) } - if strings.Contains(out, "Allocations") { + if !strings.Contains(out, "No allocations placed") { t.Fatalf("should not dump allocations") } ui.OutputWriter.Reset() @@ -119,7 +119,7 @@ func TestNodeStatusCommand_Run(t *testing.T) { if !strings.Contains(out, "mynode") { t.Fatalf("expect to find mynode, got: %s", out) } - if strings.Contains(out, "Allocations") { + if !strings.Contains(out, "No allocations placed") { t.Fatalf("should not dump allocations") } diff --git a/jobspec/parse_test.go b/jobspec/parse_test.go index 012108be5..340ed76e2 100644 --- a/jobspec/parse_test.go +++ b/jobspec/parse_test.go @@ -46,7 +46,7 @@ func TestParse(t *testing.T) { }, Update: &api.UpdateStrategy{ - Stagger: 60 * time.Second, + Stagger: helper.TimeToPtr(60 * time.Second), MaxParallel: helper.IntToPtr(2), HealthCheck: helper.StringToPtr("manual"), MinHealthyTime: helper.TimeToPtr(10 * time.Second), diff --git a/nomad/job_endpoint.go b/nomad/job_endpoint.go index 72280eee5..b37ea308d 100644 --- a/nomad/job_endpoint.go +++ b/nomad/job_endpoint.go @@ -430,7 +430,6 @@ func (j *Job) Stable(args *structs.JobStabilityRequest, reply *structs.JobStabil } // Setup the reply - reply.JobModifyIndex = modifyIndex reply.Index = modifyIndex return nil } diff --git a/nomad/job_endpoint_test.go b/nomad/job_endpoint_test.go index c811bb9f7..677896fb3 100644 --- a/nomad/job_endpoint_test.go +++ b/nomad/job_endpoint_test.go @@ -919,9 +919,6 @@ func TestJobEndpoint_Stable(t *testing.T) { if !out.Stable { t.Fatalf("Job is not marked stable") } - if out.JobModifyIndex != stableResp.JobModifyIndex { - t.Fatalf("got job modify index %d; want %d", out.JobModifyIndex, stableResp.JobModifyIndex) - } } func TestJobEndpoint_Evaluate(t *testing.T) { diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index d76f70d4e..2a92c4b44 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -332,7 +332,6 @@ type JobStabilityRequest struct { // JobStabilityResponse is the response when marking a job as stable. type JobStabilityResponse struct { - JobModifyIndex uint64 WriteMeta }