Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

functional tests: disable TestVolumeSysfs on kvm #2941

Merged
merged 1 commit into from
Jul 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 63 additions & 1 deletion tests/rkt_volume_nspawn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,70 @@

package main

import "testing"
import (
"fmt"
"os"
"testing"

"github.com/coreos/rkt/tests/testutils"
)

func TestVolumes(t *testing.T) {
NewVolumesTest().Execute(t)
}

var volSysfsTests = []struct {
name string
imgPatch string
cmdParams string
expected string
expectedError bool
}{
{
"Without any mount",
"--name=base",
"",
"/sys/class: mode: drwxr-xr-x",
false,
},
{
"With /sys as an empty volume",
"--mounts=sysdir,path=/sys,readOnly=false",
"",
"stat /sys/class: no such file or directory",
true,
},
{
"With /sys bind-mounted from the host",
"--mounts=sysdir,path=/sys,readOnly=false",
"--volume=sysdir,kind=host,source=/sys,readOnly=false",
"/sys/class: mode: drwxr-xr-x",
false,
},
{
"With /sys/class bind-mounted from the host",
"--mounts=sysdir,path=/sys/class,readOnly=false",
"--volume=sysdir,kind=host,source=/dev/null,readOnly=false",
"/sys/class: mode: Dcrw-rw-rw-",
false,
},
}

// TestVolumeSysfs checks that sysfs is available for the apps, but only if
// the app does not have mount points in /sys or a subdirectory.
// See: https://github.com/coreos/rkt/issues/2874
func TestVolumeSysfs(t *testing.T) {
ctx := testutils.NewRktRunCtx()
defer ctx.Cleanup()

for i, tt := range volSysfsTests {
t.Logf("Running test #%v: %s", i, tt.name)

img := patchTestACI("rkt-sysfs.aci", tt.imgPatch)
defer os.Remove(img)
cmd := fmt.Sprintf(`%s --debug --insecure-options=image --set-env=FILE=/sys/class run %s %s --exec /inspect -- --stat-file`,
ctx.Cmd(), tt.cmdParams, img)

runRktAndCheckOutput(t, cmd, tt.expected, tt.expectedError)
}
}
57 changes: 0 additions & 57 deletions tests/rkt_volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,60 +288,3 @@ func TestDockerVolumeSemanticsPodManifest(t *testing.T) {
runRktAndCheckOutput(t, cmd, expected, false)
}
}

var volSysfsTests = []struct {
name string
imgPatch string
cmdParams string
expected string
expectedError bool
}{
{
"Without any mount",
"--name=base",
"",
"/sys/class: mode: drwxr-xr-x",
false,
},
{
"With /sys as an empty volume",
"--mounts=sysdir,path=/sys,readOnly=false",
"",
"stat /sys/class: no such file or directory",
true,
},
{
"With /sys bind-mounted from the host",
"--mounts=sysdir,path=/sys,readOnly=false",
"--volume=sysdir,kind=host,source=/sys,readOnly=false",
"/sys/class: mode: drwxr-xr-x",
false,
},
{
"With /sys/class bind-mounted from the host",
"--mounts=sysdir,path=/sys/class,readOnly=false",
"--volume=sysdir,kind=host,source=/dev/null,readOnly=false",
"/sys/class: mode: Dcrw-rw-rw-",
false,
},
}

// TestVolumeSysfs checks that sysfs is available for the apps, but only if
// the app does not have mount points in /sys or a subdirectory.
// See: https://github.com/coreos/rkt/issues/2874
func TestVolumeSysfs(t *testing.T) {
ctx := testutils.NewRktRunCtx()
defer ctx.Cleanup()

for i, tt := range volSysfsTests {
t.Logf("Running test #%v: %s", i, tt.name)

img := patchTestACI("rkt-sysfs.aci", tt.imgPatch)
defer os.Remove(img)
cmd := fmt.Sprintf(`%s --debug --insecure-options=image --set-env=FILE=/sys/class run %s %s --exec /inspect -- --stat-file`,
ctx.Cmd(), tt.cmdParams, img)

runRktAndCheckOutput(t, cmd, tt.expected, tt.expectedError)
}

}