Fix test and simplify some boolean logic/fix metrics counting

This commit is contained in:
Alex Dadgar 2015-10-22 16:45:03 -07:00
parent 602baa37ce
commit 861a65288c
2 changed files with 3 additions and 7 deletions

View File

@ -219,11 +219,8 @@ func (iter *DynamicConstraintIterator) Next() *structs.Node {
return option
}
// In the case the job has a unique constraint it applies to all
// TaskGroups.
if iter.jobUnique && !iter.satisfiesUnique(option, true) {
continue
} else if iter.tgUnique && !iter.satisfiesUnique(option, false) {
if !iter.satisfiesUnique(option, iter.jobUnique) {
iter.ctx.Metrics().FilterNode(option, "unique")
continue
}
@ -252,9 +249,7 @@ func (iter *DynamicConstraintIterator) satisfiesUnique(option *structs.Node, job
// a job and TaskGroup collision.
jobInvalid := job && jobCollision
tgInvalid := !job && jobCollision && taskCollision
if jobInvalid || tgInvalid {
iter.ctx.Metrics().FilterNode(option, "unique")
return false
}
}

View File

@ -555,6 +555,7 @@ func TestInplaceUpdate_Success(t *testing.T) {
updates := []allocTuple{{Alloc: alloc, TaskGroup: tg}}
stack := NewGenericStack(false, ctx)
stack.SetJob(job)
// Do the inplace update.
unplaced := inplaceUpdate(ctx, eval, job, stack, updates)