@@ -1322,6 +1322,13 @@ func doPodResizeMemoryLimitDecreaseTest(f *framework.Framework) {
1322
1322
resizedPod := podresize .WaitForPodResizeActuation (ctx , f , podClient , testPod , viableLoweredLimit )
1323
1323
podresize .ExpectPodResized (ctx , f , resizedPod , viableLoweredLimit )
1324
1324
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
+
1325
1332
// 2. Decrease the limit down to a tiny amount - should fail
1326
1333
const nonViableMemoryLimit = "10Ki"
1327
1334
ginkgo .By ("Patching pod with a greatly lowered memory limit" )
@@ -1340,7 +1347,7 @@ func doPodResizeMemoryLimitDecreaseTest(f *framework.Framework) {
1340
1347
Should (framework .MakeMatcher (func (pod * v1.Pod ) (func () string , error ) {
1341
1348
// If VerifyPodStatusResources succeeds, it means the resize completed.
1342
1349
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" )
1344
1351
}
1345
1352
1346
1353
var inProgressCondition * v1.PodCondition
0 commit comments