mirror of
https://github.com/kemko/nomad.git
synced 2026-01-09 03:45:41 +03:00
test fixes
This commit is contained in:
@@ -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,
|
||||
|
||||
1
client/driver/env/env_test.go
vendored
1
client/driver/env/env_test.go
vendored
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -332,7 +332,6 @@ type JobStabilityRequest struct {
|
||||
|
||||
// JobStabilityResponse is the response when marking a job as stable.
|
||||
type JobStabilityResponse struct {
|
||||
JobModifyIndex uint64
|
||||
WriteMeta
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user