Merge pull request #235 from hqhq/hq_fix_cgroup_test

Fix cgroup mount tests
This commit is contained in:
Alexander Morozov 2015-09-01 14:57:44 -07:00
commit 05b1cda5dd
1 changed files with 16 additions and 4 deletions

View File

@ -819,7 +819,10 @@ func TestMountCgroupRO(t *testing.T) {
lines := strings.Split(mountInfo, "\n") lines := strings.Split(mountInfo, "\n")
for _, l := range lines { for _, l := range lines {
if strings.HasPrefix(l, "tmpfs on /sys/fs/cgroup") { if strings.HasPrefix(l, "tmpfs on /sys/fs/cgroup") {
if !strings.Contains(l, "ro,nosuid,nodev,noexec") { if !strings.Contains(l, "ro") ||
!strings.Contains(l, "nosuid") ||
!strings.Contains(l, "nodev") ||
!strings.Contains(l, "noexec") {
t.Fatalf("Mode expected to contain 'ro,nosuid,nodev,noexec': %s", l) t.Fatalf("Mode expected to contain 'ro,nosuid,nodev,noexec': %s", l)
} }
if !strings.Contains(l, "mode=755") { if !strings.Contains(l, "mode=755") {
@ -830,7 +833,10 @@ func TestMountCgroupRO(t *testing.T) {
if !strings.HasPrefix(l, "cgroup") { if !strings.HasPrefix(l, "cgroup") {
continue continue
} }
if !strings.Contains(l, "ro,nosuid,nodev,noexec") { if !strings.Contains(l, "ro") ||
!strings.Contains(l, "nosuid") ||
!strings.Contains(l, "nodev") ||
!strings.Contains(l, "noexec") {
t.Fatalf("Mode expected to contain 'ro,nosuid,nodev,noexec': %s", l) t.Fatalf("Mode expected to contain 'ro,nosuid,nodev,noexec': %s", l)
} }
} }
@ -862,7 +868,10 @@ func TestMountCgroupRW(t *testing.T) {
lines := strings.Split(mountInfo, "\n") lines := strings.Split(mountInfo, "\n")
for _, l := range lines { for _, l := range lines {
if strings.HasPrefix(l, "tmpfs on /sys/fs/cgroup") { if strings.HasPrefix(l, "tmpfs on /sys/fs/cgroup") {
if !strings.Contains(l, "rw,nosuid,nodev,noexec") { if !strings.Contains(l, "rw") ||
!strings.Contains(l, "nosuid") ||
!strings.Contains(l, "nodev") ||
!strings.Contains(l, "noexec") {
t.Fatalf("Mode expected to contain 'rw,nosuid,nodev,noexec': %s", l) t.Fatalf("Mode expected to contain 'rw,nosuid,nodev,noexec': %s", l)
} }
if !strings.Contains(l, "mode=755") { if !strings.Contains(l, "mode=755") {
@ -873,7 +882,10 @@ func TestMountCgroupRW(t *testing.T) {
if !strings.HasPrefix(l, "cgroup") { if !strings.HasPrefix(l, "cgroup") {
continue continue
} }
if !strings.Contains(l, "rw,nosuid,nodev,noexec") { if !strings.Contains(l, "rw") ||
!strings.Contains(l, "nosuid") ||
!strings.Contains(l, "nodev") ||
!strings.Contains(l, "noexec") {
t.Fatalf("Mode expected to contain 'rw,nosuid,nodev,noexec': %s", l) t.Fatalf("Mode expected to contain 'rw,nosuid,nodev,noexec': %s", l)
} }
} }