mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
command: fix tests after job validation
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user