From da35ecc4f38fa12f272b84d48306b23fc158c61d Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Wed, 16 Sep 2015 11:42:28 -0700 Subject: [PATCH] command: fix tests after job validation --- command/status_test.go | 5 ++--- command/util_test.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/command/status_test.go b/command/status_test.go index f58dc9b3a..e5561e0d8 100644 --- a/command/status_test.go +++ b/command/status_test.go @@ -4,7 +4,6 @@ import ( "strings" "testing" - "github.com/hashicorp/nomad/api" "github.com/mitchellh/cli" ) @@ -32,11 +31,11 @@ func TestStatusCommand_Run(t *testing.T) { } // Register two jobs - job1 := api.NewBatchJob("job1", "myjob", 1) + job1 := testJob("job1") if _, _, err := client.Jobs().Register(job1, nil); err != nil { t.Fatalf("err: %s", err) } - job2 := api.NewBatchJob("job2", "myjob", 1) + job2 := testJob("job2") if _, _, err := client.Jobs().Register(job2, nil); err != nil { t.Fatalf("err: %s", err) } diff --git a/command/util_test.go b/command/util_test.go index 16fb62c91..5515a3865 100644 --- a/command/util_test.go +++ b/command/util_test.go @@ -37,3 +37,17 @@ func testServer( } return srv, client, clientConf.Address } + +func testJob(jobID string) *api.Job { + task := api.NewTask("task1", "exec"). + Require(&api.Resources{MemoryMB: 256}) + + group := api.NewTaskGroup("group1", 1). + AddTask(task) + + job := api.NewBatchJob(jobID, jobID, "region1", 1). + AddDatacenter("dc1"). + AddTaskGroup(group) + + return job +}