Skip to content

Commit 0fcc0e5

Browse files
committed
test: update eviction threshold tests to reflect evictionSoft being ignored
1 parent 7058ca5 commit 0fcc0e5

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

pkg/providers/instancetype/suite_test.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,11 +1338,11 @@ var _ = Describe("InstanceTypeProvider", func() {
13381338
nodeClass.AMIFamily(),
13391339
nil,
13401340
)
1341-
Expect(it.Overhead.EvictionThreshold.Memory().String()).To(Equal("50Mi"))
1341+
Expect(it.Overhead.EvictionThreshold.Memory().String()).To(Equal("100Mi"))
13421342
})
13431343
})
13441344
Context("Eviction Soft", func() {
1345-
It("should override eviction threshold when specified as a quantity", func() {
1345+
It("should use default threshold when only evictionSoft is specified", func() {
13461346
nodeClass.Spec.Kubelet = &v1.KubeletConfiguration{
13471347
SystemReserved: map[string]string{
13481348
string(corev1.ResourceMemory): "20Gi",
@@ -1370,9 +1370,9 @@ var _ = Describe("InstanceTypeProvider", func() {
13701370
nodeClass.AMIFamily(),
13711371
nil,
13721372
)
1373-
Expect(it.Overhead.EvictionThreshold.Memory().String()).To(Equal("500Mi"))
1373+
Expect(it.Overhead.EvictionThreshold.Memory().String()).To(Equal("100Mi"))
13741374
})
1375-
It("should override eviction threshold when specified as a percentage value", func() {
1375+
It("should use evictionHard percentage and ignore evictionSoft percentage", func() {
13761376
nodeClass.Spec.Kubelet = &v1.KubeletConfiguration{
13771377
SystemReserved: map[string]string{
13781378
string(corev1.ResourceMemory): "20Gi",
@@ -1403,9 +1403,9 @@ var _ = Describe("InstanceTypeProvider", func() {
14031403
nodeClass.AMIFamily(),
14041404
nil,
14051405
)
1406-
Expect(it.Overhead.EvictionThreshold.Memory().Value()).To(BeNumerically("~", float64(it.Capacity.Memory().Value())*0.1, 10))
1406+
Expect(it.Overhead.EvictionThreshold.Memory().Value()).To(BeNumerically("~", float64(it.Capacity.Memory().Value())*0.05, 10))
14071407
})
1408-
It("should consider the eviction threshold disabled when specified as 100%", func() {
1408+
It("should use default threshold when evictionSoft is 100% (ignored)", func() {
14091409
nodeClass.Spec.Kubelet = &v1.KubeletConfiguration{
14101410
SystemReserved: map[string]string{
14111411
string(corev1.ResourceMemory): "20Gi",
@@ -1433,7 +1433,7 @@ var _ = Describe("InstanceTypeProvider", func() {
14331433
nodeClass.AMIFamily(),
14341434
nil,
14351435
)
1436-
Expect(it.Overhead.EvictionThreshold.Memory().String()).To(Equal("0"))
1436+
Expect(it.Overhead.EvictionThreshold.Memory().String()).To(Equal("100Mi"))
14371437
})
14381438
It("should ignore eviction threshold when using Bottlerocket AMI", func() {
14391439
nodeClass.Spec.AMISelectorTerms = []v1.AMISelectorTerm{{Alias: "bottlerocket@latest"}}
@@ -2621,7 +2621,6 @@ var _ = Describe("InstanceTypeProvider", func() {
26212621
// kubelet.kubeReserved
26222622
// kubelet.systemReserved
26232623
// kubelet.evictionHard
2624-
// kubelet.evictionSoft
26252624
// kubelet.maxPods
26262625
nodeClass.Spec.Kubelet = &v1.KubeletConfiguration{
26272626
KubeReserved: map[string]string{string(corev1.ResourceCPU): "1"},
@@ -2637,7 +2636,6 @@ var _ = Describe("InstanceTypeProvider", func() {
26372636
{KubeReserved: map[string]string{string(corev1.ResourceCPU): "20"}},
26382637
{SystemReserved: map[string]string{string(corev1.ResourceMemory): "10Gi"}},
26392638
{EvictionHard: map[string]string{"memory.available": "52%"}},
2640-
{EvictionSoft: map[string]string{"nodefs.available": "132%"}},
26412639
{MaxPods: aws.Int32(20)},
26422640
}
26432641
ExpectApplied(ctx, env.Client, nodeClass)
@@ -2659,7 +2657,7 @@ var _ = Describe("InstanceTypeProvider", func() {
26592657
instanceTypeResults = append(instanceTypeResults, instancetypes)
26602658
}
26612659

2662-
// Based on the nodeclass configuration, we expect to have 5 unique set of instance types
2660+
// Based on the nodeclass configuration, we expect to have 4 unique set of instance types
26632661
ExpectUniqueInstanceTypeLists(instanceTypeResults...)
26642662
})
26652663
It("changes to nodeclass fields should result in a different set of instances types", func() {

0 commit comments

Comments
 (0)