Fix test and simplify some boolean logic/fix metrics counting
This commit is contained in:
parent
602baa37ce
commit
861a65288c
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue