This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new b9db5c4e6 [cgroups2] Fix ROOT_CGROUPS_MemoryForward for cgroups2.
b9db5c4e6 is described below

commit b9db5c4e66434d8f01d9d5cbfb24ef7a3aa29c80
Author: Jason Zhou <[email protected]>
AuthorDate: Fri Aug 9 18:06:23 2024 -0400

    [cgroups2] Fix ROOT_CGROUPS_MemoryForward for cgroups2.
    
    The ROOT_CGROUPS_MemoryForward test is currently failing because it is
    looking for the memory hierarchy, which no longer exists in cgroups2 due
    to the new unified hierarchy.
    
    We skip this hierarchy check if we detect cgroups2 is mounted on the
    system.
    
    Review: https://reviews.apache.org/r/75161/
---
 src/tests/containerizer/cgroups_isolator_tests.cpp | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/tests/containerizer/cgroups_isolator_tests.cpp 
b/src/tests/containerizer/cgroups_isolator_tests.cpp
index 2f5f93bfa..f2d6d2741 100644
--- a/src/tests/containerizer/cgroups_isolator_tests.cpp
+++ b/src/tests/containerizer/cgroups_isolator_tests.cpp
@@ -2366,15 +2366,19 @@ TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_MemoryForward)
 
   EXPECT_TRUE(usage->has_mem_total_bytes());
 
-  Result<string> hierarchy = cgroups::hierarchy("memory");
-  ASSERT_SOME(hierarchy);
+  if (cgroupsV2()) {
+    EXPECT_TRUE(usage->has_mem_kmem_usage_bytes());
+  } else {
+    Result<string> hierarchy = cgroups::hierarchy("memory");
+    ASSERT_SOME(hierarchy);
 
-  Try<bool> exists = cgroups::exists(
-      hierarchy.get(), "memory.kmem.usage_in_bytes");
-  ASSERT_SOME(exists);
+    Try<bool> exists = cgroups::exists(
+        hierarchy.get(), "memory.kmem.usage_in_bytes");
+    ASSERT_SOME(exists);
 
-  if (exists.get()) {
-    EXPECT_TRUE(usage->has_mem_kmem_usage_bytes());
+    if (exists.get()) {
+      EXPECT_TRUE(usage->has_mem_kmem_usage_bytes());
+    }
   }
 
   driver.stop();

Reply via email to