Skip to content

Commit 01470d9

Browse files
committed
Fix memory limit decrease test on cri-o
1 parent 032142c commit 01470d9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/e2e/common/node/pod_resize.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,13 @@ func doPodResizeMemoryLimitDecreaseTest(f *framework.Framework) {
13221322
resizedPod := podresize.WaitForPodResizeActuation(ctx, f, podClient, testPod, viableLoweredLimit)
13231323
podresize.ExpectPodResized(ctx, f, resizedPod, viableLoweredLimit)
13241324

1325+
// There is some latency after container startup before memory usage is scraped. On CRI-O
1326+
// this latency is much higher, so wait enough time for cAdvisor to scrape metrics twice.
1327+
ginkgo.By("Waiting for stats scraping")
1328+
const scrapingDelay = 30 * time.Second // 2 * maxHousekeepingInterval
1329+
startTime := testPod.Status.StartTime
1330+
time.Sleep(time.Until(startTime.Add(scrapingDelay)))
1331+
13251332
// 2. Decrease the limit down to a tiny amount - should fail
13261333
const nonViableMemoryLimit = "10Ki"
13271334
ginkgo.By("Patching pod with a greatly lowered memory limit")
@@ -1340,7 +1347,7 @@ func doPodResizeMemoryLimitDecreaseTest(f *framework.Framework) {
13401347
Should(framework.MakeMatcher(func(pod *v1.Pod) (func() string, error) {
13411348
// If VerifyPodStatusResources succeeds, it means the resize completed.
13421349
if podresize.VerifyPodStatusResources(pod, nonViableLoweredLimit) == nil {
1343-
return nil, fmt.Errorf("non-viable resize unexpectedly completed")
1350+
return nil, gomega.StopTrying("non-viable resize unexpectedly completed")
13441351
}
13451352

13461353
var inProgressCondition *v1.PodCondition

0 commit comments

Comments
 (0)