@@ -95,6 +95,7 @@ var _ = Describe("SingleNodeConsolidation", func() {
95
95
96
96
AfterEach (func () {
97
97
disruption .SingleNodeConsolidationTimeoutDuration = 3 * time .Minute
98
+ fakeClock .SetTime (time .Now ())
98
99
ExpectCleanedUp (ctx , env .Client )
99
100
})
100
101
@@ -138,7 +139,7 @@ var _ = Describe("SingleNodeConsolidation", func() {
138
139
Expect (err ).To (BeNil ())
139
140
140
141
// Combine all candidates
141
- allCandidates := append (candidates1 , append (candidates2 , candidates3 ... )... )
142
+ allCandidates := append (candidates3 , append (candidates2 , candidates1 ... )... )
142
143
143
144
// Sort candidates
144
145
sortedCandidates := consolidation .SortCandidates (allCandidates )
@@ -155,6 +156,9 @@ var _ = Describe("SingleNodeConsolidation", func() {
155
156
sortedCandidates [2 ].NodePool ().Name ,
156
157
}
157
158
Expect (nodePoolsInFirstGroup ).To (ConsistOf (nodePool1 .Name , nodePool2 .Name , nodePool3 .Name ))
159
+ for i := 0 ; i < 3 ; i ++ {
160
+ Expect (sortedCandidates [i ].DisruptionCost ()).To (Equal (1.0 ))
161
+ }
158
162
159
163
// Check next three candidates (all with cost 2)
160
164
nodePoolsInSecondGroup := []string {
@@ -163,6 +167,9 @@ var _ = Describe("SingleNodeConsolidation", func() {
163
167
sortedCandidates [5 ].NodePool ().Name ,
164
168
}
165
169
Expect (nodePoolsInSecondGroup ).To (ConsistOf (nodePool1 .Name , nodePool2 .Name , nodePool3 .Name ))
170
+ for i := 3 ; i < 6 ; i ++ {
171
+ Expect (sortedCandidates [i ].DisruptionCost ()).To (Equal (2.0 ))
172
+ }
166
173
167
174
// Check last three candidates (all with cost 3)
168
175
nodePoolsInThirdGroup := []string {
@@ -171,6 +178,9 @@ var _ = Describe("SingleNodeConsolidation", func() {
171
178
sortedCandidates [8 ].NodePool ().Name ,
172
179
}
173
180
Expect (nodePoolsInThirdGroup ).To (ConsistOf (nodePool1 .Name , nodePool2 .Name , nodePool3 .Name ))
181
+ for i := 6 ; i < 9 ; i ++ {
182
+ Expect (sortedCandidates [i ].DisruptionCost ()).To (Equal (3.0 ))
183
+ }
174
184
})
175
185
176
186
It ("should reset timed out nodepools when all nodepools are evaluated" , func () {
0 commit comments