test, cgroupv2: adjust pagefaults test

on cgroup v2 the reported metric is recursive and it includes all the
sub cgroups.

Closes: https://github.com/kubernetes/kubernetes/issues/105301

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2021-09-28 09:58:58 +02:00
parent 7cce7eec11
commit f23e2a8c7f
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED

View File

@ -115,9 +115,13 @@ var _ = SIGDescribe("Summary API [NodeConformance]", func() {
"UserDefinedMetrics": gomega.BeEmpty(), "UserDefinedMetrics": gomega.BeEmpty(),
}) })
} }
expectedPageFaultsUpperBound := 1000000
expectedMajorPageFaultsUpperBound := 10 expectedMajorPageFaultsUpperBound := 10
if IsCgroup2UnifiedMode() { if IsCgroup2UnifiedMode() {
expectedMajorPageFaultsUpperBound = 1000 // On cgroupv2 these stats are recursive, so make sure they are at least like the value set
// above for the container.
expectedPageFaultsUpperBound = 1e9
expectedMajorPageFaultsUpperBound = 100000
} }
podsContExpectations := sysContExpectations().(*gstruct.FieldsMatcher) podsContExpectations := sysContExpectations().(*gstruct.FieldsMatcher)
@ -128,7 +132,7 @@ var _ = SIGDescribe("Summary API [NodeConformance]", func() {
"UsageBytes": bounded(10*e2evolume.Kb, memoryLimit), "UsageBytes": bounded(10*e2evolume.Kb, memoryLimit),
"WorkingSetBytes": bounded(10*e2evolume.Kb, memoryLimit), "WorkingSetBytes": bounded(10*e2evolume.Kb, memoryLimit),
"RSSBytes": bounded(1*e2evolume.Kb, memoryLimit), "RSSBytes": bounded(1*e2evolume.Kb, memoryLimit),
"PageFaults": bounded(0, 1000000), "PageFaults": bounded(0, expectedPageFaultsUpperBound),
"MajorPageFaults": bounded(0, expectedMajorPageFaultsUpperBound), "MajorPageFaults": bounded(0, expectedMajorPageFaultsUpperBound),
}) })
runtimeContExpectations := sysContExpectations().(*gstruct.FieldsMatcher) runtimeContExpectations := sysContExpectations().(*gstruct.FieldsMatcher)