mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 09:25:46 +03:00
scheduler: update tests to filter terminal allocs
This commit is contained in:
@@ -680,6 +680,9 @@ type Allocation struct {
|
||||
JobID string
|
||||
Job *Job
|
||||
|
||||
// TaskGroup is the name of the task group that should be run
|
||||
TaskGroup string
|
||||
|
||||
// Resources is the set of resources allocated as part
|
||||
// of this allocation of the task group.
|
||||
Resources *Resources
|
||||
|
||||
@@ -254,6 +254,7 @@ func (s *GenericScheduler) computePlacements(job *structs.Job, place []allocTupl
|
||||
NodeID: nodeID,
|
||||
JobID: job.ID,
|
||||
Job: job,
|
||||
TaskGroup: missing.TaskGroup.Name,
|
||||
Resources: size,
|
||||
Metrics: ctx.Metrics(),
|
||||
Status: status,
|
||||
|
||||
@@ -184,8 +184,9 @@ func TestServiceSched_JobModify(t *testing.T) {
|
||||
noErr(t, err)
|
||||
|
||||
// Ensure all allocations placed
|
||||
out = structs.FilterTerminalAllocs(out)
|
||||
if len(out) != 10 {
|
||||
t.Fatalf("bad: %#v", out)
|
||||
t.Fatalf("bad: %d %#v", out)
|
||||
}
|
||||
|
||||
h.AssertEvalStatus(t, structs.EvalStatusComplete)
|
||||
@@ -236,6 +237,7 @@ func TestServiceSched_JobDeregister(t *testing.T) {
|
||||
noErr(t, err)
|
||||
|
||||
// Ensure no remaining allocations
|
||||
out = structs.FilterTerminalAllocs(out)
|
||||
if len(out) != 0 {
|
||||
t.Fatalf("bad: %#v", out)
|
||||
}
|
||||
@@ -311,6 +313,7 @@ func TestServiceSched_NodeDrain(t *testing.T) {
|
||||
noErr(t, err)
|
||||
|
||||
// Ensure all allocations placed
|
||||
out = structs.FilterTerminalAllocs(out)
|
||||
if len(out) != 10 {
|
||||
t.Fatalf("bad: %#v", out)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user