SkipIfCgroupNamespacesNotSupported skips the test if the running docker daemon doesn't support cgroup namespaces
(t *testing.T)
| 91 | |
| 92 | // SkipIfCgroupNamespacesNotSupported skips the test if the running docker daemon doesn't support cgroup namespaces |
| 93 | func SkipIfCgroupNamespacesNotSupported(t *testing.T) { |
| 94 | t.Helper() |
| 95 | result := icmd.RunCmd(icmd.Command("docker", "info", "--format", "{{.SecurityOptions}}")) |
| 96 | result.Assert(t, icmd.Expected{Err: icmd.None}) |
| 97 | cgroupNsFound := strings.Contains(result.Stdout(), "name=cgroupns") |
| 98 | |
| 99 | skip.If(t, !cgroupNsFound, fmt.Sprintf("running against a daemon that doesn't support cgroup namespaces (security options: %s)", result.Stdout())) |
| 100 | } |
| 101 | |
| 102 | // SkipIfNotPlatform skips the test if the running docker daemon is not running on a specific platform. |
| 103 | // platform should be in format os/arch (for example linux/arm64). |