Skip to content

Commit f1dd03f

Browse files
committed
test addition
1 parent 4d94c4c commit f1dd03f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pkg/controllers/disruption/singlenodeconsolidation_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ var _ = Describe("SingleNodeConsolidation", func() {
9595

9696
AfterEach(func() {
9797
disruption.SingleNodeConsolidationTimeoutDuration = 3 * time.Minute
98+
fakeClock.SetTime(time.Now())
9899
ExpectCleanedUp(ctx, env.Client)
99100
})
100101

@@ -138,7 +139,7 @@ var _ = Describe("SingleNodeConsolidation", func() {
138139
Expect(err).To(BeNil())
139140

140141
// Combine all candidates
141-
allCandidates := append(candidates1, append(candidates2, candidates3...)...)
142+
allCandidates := append(candidates3, append(candidates2, candidates1...)...)
142143

143144
// Sort candidates
144145
sortedCandidates := consolidation.SortCandidates(allCandidates)
@@ -155,6 +156,9 @@ var _ = Describe("SingleNodeConsolidation", func() {
155156
sortedCandidates[2].NodePool().Name,
156157
}
157158
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+
}
158162

159163
// Check next three candidates (all with cost 2)
160164
nodePoolsInSecondGroup := []string{
@@ -163,6 +167,9 @@ var _ = Describe("SingleNodeConsolidation", func() {
163167
sortedCandidates[5].NodePool().Name,
164168
}
165169
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+
}
166173

167174
// Check last three candidates (all with cost 3)
168175
nodePoolsInThirdGroup := []string{
@@ -171,6 +178,9 @@ var _ = Describe("SingleNodeConsolidation", func() {
171178
sortedCandidates[8].NodePool().Name,
172179
}
173180
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+
}
174184
})
175185

176186
It("should reset timed out nodepools when all nodepools are evaluated", func() {

0 commit comments

Comments
 (0)