(t *testing.T)
| 879 | } |
| 880 | |
| 881 | func TestMountCgroupRW(t *testing.T) { |
| 882 | if testing.Short() { |
| 883 | return |
| 884 | } |
| 885 | config := newTemplateConfig(t, nil) |
| 886 | // clear the RO flag from cgroup mount |
| 887 | for _, m := range config.Mounts { |
| 888 | if m.Device == "cgroup" { |
| 889 | m.Flags = defaultMountFlags |
| 890 | break |
| 891 | } |
| 892 | } |
| 893 | |
| 894 | buffers := runContainerOk(t, config, "mount") |
| 895 | |
| 896 | mountInfo := buffers.Stdout.String() |
| 897 | lines := strings.SplitSeq(mountInfo, "\n") |
| 898 | for l := range lines { |
| 899 | if strings.HasPrefix(l, "tmpfs on /sys/fs/cgroup") { |
| 900 | if !strings.Contains(l, "rw") || |
| 901 | !strings.Contains(l, "nosuid") || |
| 902 | !strings.Contains(l, "nodev") || |
| 903 | !strings.Contains(l, "noexec") { |
| 904 | t.Fatalf("Mode expected to contain 'rw,nosuid,nodev,noexec': %s", l) |
| 905 | } |
| 906 | if !strings.Contains(l, "mode=755") { |
| 907 | t.Fatalf("Mode expected to contain 'mode=755': %s", l) |
| 908 | } |
| 909 | continue |
| 910 | } |
| 911 | if !strings.HasPrefix(l, "cgroup") { |
| 912 | continue |
| 913 | } |
| 914 | if !strings.Contains(l, "rw") || |
| 915 | !strings.Contains(l, "nosuid") || |
| 916 | !strings.Contains(l, "nodev") || |
| 917 | !strings.Contains(l, "noexec") { |
| 918 | t.Fatalf("Mode expected to contain 'rw,nosuid,nodev,noexec': %s", l) |
| 919 | } |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | func TestOomScoreAdj(t *testing.T) { |
| 924 | if testing.Short() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…