Skip to content

Commit

Permalink
Fix CmdModifierTest#testMemoryLimitModified in cgroup2 environment.
Browse files Browse the repository at this point in the history
The `testMemoryLimitModified` was failing in cgroup2 environment because of the missing
`/sys/fs/cgroup/memory/memory.limit_in_bytes` file.

In the cgroup2 environment a new file should be checked instead -- `/sys/fs/cgroup/memory.max`.

This commit intrdocues changes to `cat` both files:

1. `/sys/fs/cgroup/memory/memory.limit_in_bytes` from the first version of cgroup
2. `/sys/fs/cgroup/memory.max` from the second

Similar issues:

1. oracle/docker-images#1939
2. apify/crawlee#693
  • Loading branch information
cac03 committed Aug 17, 2021
1 parent 8638330 commit f5c0864
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ public void testHostnameModified() throws IOException, InterruptedException {

@Test
public void testMemoryLimitModified() throws IOException, InterruptedException {
final Container.ExecResult execResult = memoryLimitedRedis.execInContainer("cat", "/sys/fs/cgroup/memory/memory.limit_in_bytes");
final Container.ExecResult execResult = memoryLimitedRedis.execInContainer(
"cat",
"/sys/fs/cgroup/memory/memory.limit_in_bytes",
"/sys/fs/cgroup/memory.max"
);
assertEquals(String.valueOf(memoryInBytes), execResult.getStdout().trim());
}
}

0 comments on commit f5c0864

Please sign in to comment.