prevent predicatesOrdering from escaping from UT

- sets `predicatesOrdering` back to original value in UT
This commit is contained in:
Wei Huang
2019-05-08 18:03:58 -07:00
parent 5bd88c85bf
commit c4df3a2c44
3 changed files with 16 additions and 9 deletions

View File

@@ -77,3 +77,13 @@ func portsConflict(existingPorts schedulernodeinfo.HostPortInfo, wantPorts []*v1
return false
}
// SetPredicatesOrderingDuringTest sets the predicatesOrdering to the specified
// value, and returns a function that restores the original value.
func SetPredicatesOrderingDuringTest(value []string) func() {
origVal := predicatesOrdering
predicatesOrdering = value
return func() {
predicatesOrdering = origVal
}
}