bmahler commented on code in PR #519:
URL: https://github.com/apache/mesos/pull/519#discussion_r1529406486


##########
src/tests/containerizer/cgroups2_tests.cpp:
##########
@@ -59,6 +63,30 @@ TEST_F(Cgroups2Test, ROOT_CGROUPS2_AvailableSubsystems)
   }
 }
 
+
+TEST_F(Cgroups2Test, ROOT_CGROUPS2_DeviceController)
+{
+  namespace devices = cgroups2::devices;
+
+  // Deny all access.
+  devices::Entry entry = devices::Entry::parse("a *:* rwm").get();
+
+  EXPECT_SOME(devices::configure(cgroups2::ROOT_CGROUP, {}, {entry}));
+  Try<vector<uint32_t>> attached = ebpf::cgroups2::attached(
+      cgroups2::ROOT_CGROUP);
+
+  ASSERT_SOME(attached);
+  EXPECT_EQ(1, (int) attached->size());
+
+  // Verify that we can't open /dev/null.
+  EXPECT_ERROR(os::open(os::DEV_NULL, O_RDWR));
+
+  EXPECT_SOME(ebpf::cgroups2::detach(cgroups2::ROOT_CGROUP, 
attached.get()[0]));

Review Comment:
   it would need to be `(*attached)[0]` due to operator precedence rules IIRC



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to