Skip to content

Commit

Permalink
feat: linux control group version 2 API support cgroup v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ChangxinDong committed Oct 26, 2022
1 parent d9201ba commit 677f684
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.mockito.Spy;
import org.mockito.junit.jupiter.MockitoExtension;

import java.io.IOException;
Expand Down Expand Up @@ -95,6 +96,7 @@
class GenericExternalServiceIntegTest extends BaseITCase {
private Kernel kernel;

@Spy
LinuxPlatform linuxPlatform;

private final static String ROOT_PATH_STRING = "/systest21/fs/cgroup";
Expand Down Expand Up @@ -655,10 +657,13 @@ void GIVEN_linux_resource_limits_WHEN_it_changes_THEN_component_runs_with_new_re
}
});

linuxPlatform = kernel.getContext().get(LinuxPlatform.class);
linuxPlatform = spy(kernel.getContext().get(LinuxPlatform.class));

createComponentData(echoComponentName);
createComponentData(mainComponentName);

// Due to cgroup v1 is active by default (in test platform), and the directories of cgroup v1 are read-only
// therefore, here create some directories and files as fake cgroup v2 files to support testing
Field controllerField = LinuxPlatform.class.getDeclaredField("CGROUP_CONTROLLERS");
setFinalStatic(controllerField, Paths.get(componentPathString + "/memory.max"));
systemResourceController = linuxPlatform.getSystemResourceController();
Expand Down

0 comments on commit 677f684

Please sign in to comment.