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


##########
src/tests/containerizer/cgroups2_tests.cpp:
##########
@@ -210,6 +221,119 @@ TEST_F(Cgroups2Test, ROOT_CGROUPS2_EnableAndDisable)
   EXPECT_EQ(0u, enabled->count("cpu"));
 }
 
+// Combination of a path and access flags.
+typedef pair<string, int> Access;
+
+using DeviceControllerTestParams = tuple<
+    vector<devices::Entry>, 
+    vector<devices::Entry>,
+    vector<Access>, 
+    vector<Access>>;
+
+class DeviceControllerTestFixture :
+    public Cgroups2Test,
+    public ::testing::WithParamInterface<DeviceControllerTestParams> {};
+
+
+TEST_P(DeviceControllerTestFixture, ROOT_CGROUPS2_DeviceController) {
+  const string& cgroup = TEST_CGROUP;
+
+  auto params = GetParam();
+  const vector<devices::Entry> allow = std::get<0>(params);
+  const vector<devices::Entry> deny = std::get<1>(params);
+  const vector<Access> allowedAccesses = std::get<2>(params);
+  const vector<Access> blockedAccesses = std::get<3>(params);
+
+  if (!cgroups2::exists(cgroup)) {
+    ASSERT_SOME(cgroups2::create(cgroup));
+  }
+  string path = cgroups2::path(cgroup);
+
+  ASSERT_SOME(devices::configure(cgroup, allow, deny));
+  Try<vector<uint32_t>> attached = ebpf::cgroups2::attached(path);
+  EXPECT_SOME(attached);
+  EXPECT_EQ(1u, attached->size());
+
+  pid_t pid = ::fork();
+  ASSERT_NE(-1, pid);

Review Comment:
   ideally we'd do something that's errno aware here



-- 
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