parent
e73bb6d302
commit
9e9fec3a09
|
@ -270,7 +270,7 @@ func RandomID(prefix string) string {
|
|||
// same name, sometimes between test runs the socket does not get cleaned up
|
||||
// quickly enough, causing container creation to fail.
|
||||
func RandomContainerID() string {
|
||||
return RandomID("test-container-")
|
||||
return RandomID("test-container")
|
||||
}
|
||||
|
||||
// Copy copies file from src to dst.
|
||||
|
|
|
@ -264,7 +264,7 @@ type CreateMountTestcase struct {
|
|||
expectedPaths []string
|
||||
}
|
||||
|
||||
func createMountTestcases(vfs2 bool) []*CreateMountTestcase {
|
||||
func createMountTestcases() []*CreateMountTestcase {
|
||||
testCases := []*CreateMountTestcase{
|
||||
&CreateMountTestcase{
|
||||
// Only proc.
|
||||
|
@ -409,32 +409,26 @@ func createMountTestcases(vfs2 bool) []*CreateMountTestcase {
|
|||
Destination: "/proc",
|
||||
Type: "tmpfs",
|
||||
},
|
||||
// TODO (gvisor.dev/issue/1487): Re-add this case when sysfs supports
|
||||
// MkDirAt in VFS2 (and remove the reduntant append).
|
||||
// {
|
||||
// Destination: "/sys/bar",
|
||||
// Type: "tmpfs",
|
||||
// },
|
||||
//
|
||||
{
|
||||
Destination: "/sys/bar",
|
||||
Type: "tmpfs",
|
||||
},
|
||||
|
||||
{
|
||||
Destination: "/tmp/baz",
|
||||
Type: "tmpfs",
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedPaths: []string{"/proc", "/sys" /* "/sys/bar" ,*/, "/tmp", "/tmp/baz"},
|
||||
expectedPaths: []string{"/proc", "/sys", "/sys/bar", "/tmp", "/tmp/baz"},
|
||||
}
|
||||
|
||||
if !vfs2 {
|
||||
vfsCase.spec.Mounts = append(vfsCase.spec.Mounts, specs.Mount{Destination: "/sys/bar", Type: "tmpfs"})
|
||||
vfsCase.expectedPaths = append(vfsCase.expectedPaths, "/sys/bar")
|
||||
}
|
||||
return append(testCases, vfsCase)
|
||||
}
|
||||
|
||||
// Test that MountNamespace can be created with various specs.
|
||||
func TestCreateMountNamespace(t *testing.T) {
|
||||
for _, tc := range createMountTestcases(false /* vfs2 */) {
|
||||
for _, tc := range createMountTestcases() {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
conf := testConfig()
|
||||
ctx := contexttest.Context(t)
|
||||
|
@ -471,7 +465,7 @@ func TestCreateMountNamespace(t *testing.T) {
|
|||
|
||||
// Test that MountNamespace can be created with various specs.
|
||||
func TestCreateMountNamespaceVFS2(t *testing.T) {
|
||||
for _, tc := range createMountTestcases(true /* vfs2 */) {
|
||||
for _, tc := range createMountTestcases() {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
spec := testSpec()
|
||||
spec.Mounts = tc.spec.Mounts
|
||||
|
|
|
@ -316,6 +316,7 @@ func configs(t *testing.T, opts ...configOption) map[string]*config.Config {
|
|||
return cs
|
||||
}
|
||||
|
||||
// TODO(gvisor.dev/issue/1624): Merge with configs when VFS2 is the default.
|
||||
func configsWithVFS2(t *testing.T, opts ...configOption) map[string]*config.Config {
|
||||
all := configs(t, opts...)
|
||||
for key, value := range configs(t, opts...) {
|
||||
|
@ -894,13 +895,15 @@ func TestKillPid(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestCheckpointRestore creates a container that continuously writes successive integers
|
||||
// to a file. To test checkpoint and restore functionality, the container is
|
||||
// checkpointed and the last number printed to the file is recorded. Then, it is restored in two
|
||||
// new containers and the first number printed from these containers is checked. Both should
|
||||
// be the next consecutive number after the last number from the checkpointed container.
|
||||
// TestCheckpointRestore creates a container that continuously writes successive
|
||||
// integers to a file. To test checkpoint and restore functionality, the
|
||||
// container is checkpointed and the last number printed to the file is
|
||||
// recorded. Then, it is restored in two new containers and the first number
|
||||
// printed from these containers is checked. Both should be the next consecutive
|
||||
// number after the last number from the checkpointed container.
|
||||
func TestCheckpointRestore(t *testing.T) {
|
||||
// Skip overlay because test requires writing to host file.
|
||||
// TODO(gvisor.dev/issue/1663): Add VFS when S/R support is added.
|
||||
for name, conf := range configs(t, noOverlay...) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
dir, err := ioutil.TempDir(testutil.TmpDir(), "checkpoint-test")
|
||||
|
@ -1062,6 +1065,7 @@ func TestCheckpointRestore(t *testing.T) {
|
|||
// with filesystem Unix Domain Socket use.
|
||||
func TestUnixDomainSockets(t *testing.T) {
|
||||
// Skip overlay because test requires writing to host file.
|
||||
// TODO(gvisor.dev/issue/1663): Add VFS when S/R support is added.
|
||||
for name, conf := range configs(t, noOverlay...) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
// UDS path is limited to 108 chars for compatibility with older systems.
|
||||
|
@ -1199,7 +1203,7 @@ func TestUnixDomainSockets(t *testing.T) {
|
|||
// recreated. Then it resumes the container, verify that the file gets created
|
||||
// again.
|
||||
func TestPauseResume(t *testing.T) {
|
||||
for name, conf := range configs(t, noOverlay...) {
|
||||
for name, conf := range configsWithVFS2(t, noOverlay...) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
tmpDir, err := ioutil.TempDir(testutil.TmpDir(), "lock")
|
||||
if err != nil {
|
||||
|
|
|
@ -203,7 +203,6 @@ def syscall_test(
|
|||
tags = platform_tags + tags,
|
||||
)
|
||||
|
||||
# TODO(gvisor.dev/issue/1487): Enable VFS2 overlay tests.
|
||||
if add_overlay:
|
||||
_syscall_test(
|
||||
test = test,
|
||||
|
@ -216,6 +215,23 @@ def syscall_test(
|
|||
overlay = True,
|
||||
)
|
||||
|
||||
# TODO(gvisor.dev/issue/4407): Remove tags to enable VFS2 overlay tests.
|
||||
overlay_vfs2_tags = list(vfs2_tags)
|
||||
overlay_vfs2_tags.append("manual")
|
||||
overlay_vfs2_tags.append("noguitar")
|
||||
overlay_vfs2_tags.append("notap")
|
||||
_syscall_test(
|
||||
test = test,
|
||||
shard_count = shard_count,
|
||||
size = size,
|
||||
platform = default_platform,
|
||||
use_tmpfs = use_tmpfs,
|
||||
add_uds_tree = add_uds_tree,
|
||||
tags = platforms[default_platform] + overlay_vfs2_tags,
|
||||
overlay = True,
|
||||
vfs2 = True,
|
||||
)
|
||||
|
||||
if add_hostinet:
|
||||
_syscall_test(
|
||||
test = test,
|
||||
|
|
Loading…
Reference in New Issue