Merge pull request #120948 from marosset/fix-mem-limit-windows-test

Fixing attempt to deploy past allocatable memory limits test on Windows
This commit is contained in:
Kubernetes Prow Robot 2023-09-29 14:33:57 -07:00 committed by GitHub
commit 3e9f2f4d65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,9 +105,12 @@ func overrideAllocatableMemoryTest(ctx context.Context, f *framework.Framework,
})
framework.ExpectNoError(err)
framework.Logf("Scheduling 1 pod per node to consume all allocatable memory")
for _, node := range nodeList.Items {
status := node.Status
podMemLimt := resource.NewQuantity(status.Allocatable.Memory().Value()-(1024*1024*100), resource.BinarySI)
podName := "mem-test-" + string(uuid.NewUUID())
framework.Logf("Scheduling pod %s on node %s (allocatable memory=%v) with memory limit %v", podName, node.Name, status.Allocatable.Memory(), podMemLimt)
pod := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: podName,
@ -119,7 +122,7 @@ func overrideAllocatableMemoryTest(ctx context.Context, f *framework.Framework,
Image: imageutils.GetPauseImageName(),
Resources: v1.ResourceRequirements{
Limits: v1.ResourceList{
v1.ResourceMemory: status.Allocatable[v1.ResourceMemory],
v1.ResourceMemory: *podMemLimt,
},
},
},
@ -133,6 +136,7 @@ func overrideAllocatableMemoryTest(ctx context.Context, f *framework.Framework,
_, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(ctx, pod, metav1.CreateOptions{})
framework.ExpectNoError(err)
}
framework.Logf("Schedule additional pod which should not get scheduled")
podName := "mem-failure-pod"
failurePod := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
@ -155,6 +159,7 @@ func overrideAllocatableMemoryTest(ctx context.Context, f *framework.Framework,
},
},
}
framework.Logf("Ensuring that pod %s fails to schedule", podName)
failurePod, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(ctx, failurePod, metav1.CreateOptions{})
framework.ExpectNoError(err)
gomega.Eventually(ctx, func() bool {
@ -169,7 +174,6 @@ func overrideAllocatableMemoryTest(ctx context.Context, f *framework.Framework,
}
return false
}, 3*time.Minute, 10*time.Second).Should(gomega.BeTrue())
}
// getNodeMemory populates a nodeMemory struct with information from the first