scheduler: update tests to filter terminal allocs

This commit is contained in:
Armon Dadgar
2015-08-23 16:30:57 -07:00
parent 5f11b99caa
commit 8b97638318
3 changed files with 8 additions and 1 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -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)
}