diff --git a/test/e2e/windows/memory_limits.go b/test/e2e/windows/memory_limits.go index 603031eb8fa..da96baad3fe 100644 --- a/test/e2e/windows/memory_limits.go +++ b/test/e2e/windows/memory_limits.go @@ -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