summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZach Koopmans <zkoopmans@google.com>2020-08-11 10:35:46 -0700
committergVisor bot <gvisor-bot@google.com>2020-08-11 10:37:32 -0700
commit89f3197fc368702cbe1842932d9cfbede250269f (patch)
treefbdbc563ba38831140a2349022d25e5bdd3b4db1
parent8e31f0dc57d44fb463441f6156fba5c240369dfe (diff)
Mark integration tests as passing in VFS2 except CheckpointRestore.
Mark all tests passing for VFS2 in: image_test integration_test There's no way to do negative look ahead/behind in golang test regex, so check if the tests uses VFS2 and skip CheckPointRestore if it does. PiperOrigin-RevId: 326050915
-rw-r--r--Makefile6
-rw-r--r--pkg/test/dockerutil/dockerutil.go54
-rwxr-xr-xscripts/docker_tests.sh5
-rw-r--r--test/e2e/integration_test.go7
4 files changed, 51 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index d62567939..fdbc6fb41 100644
--- a/Makefile
+++ b/Makefile
@@ -166,15 +166,11 @@ do-tests: runsc
simple-tests: unit-tests # Compatibility target.
.PHONY: simple-tests
-# Keep these in sync with //scripts/docker_tests.sh.
-IMAGE_FILTER := HelloWorld\|Httpd\|Ruby\|Stdio
-INTEGRATION_FILTER := Life\|Pause\|Connect\|JobControl\|Overlay\|Exec\|DirCreation\|Link
-
docker-tests: load-basic-images
@$(call submake,install-test-runtime RUNTIME="vfs1")
@$(call submake,test-runtime RUNTIME="vfs1" TARGETS="$(INTEGRATION_TARGETS)")
@$(call submake,install-test-runtime RUNTIME="vfs2" ARGS="--vfs2")
- @$(call submake,test-runtime RUNTIME="vfs2" OPTIONS="--test_filter=$(IMAGE_FILTER)\|$(INTEGRATION_FILTER)" TARGETS="$(INTEGRATION_TARGETS)")
+ @$(call submake,test-runtime RUNTIME="vfs2" TARGETS="$(INTEGRATION_TARGETS)")
.PHONY: docker-tests
overlay-tests: load-basic-images
diff --git a/pkg/test/dockerutil/dockerutil.go b/pkg/test/dockerutil/dockerutil.go
index 5a9dd8bd8..952871f95 100644
--- a/pkg/test/dockerutil/dockerutil.go
+++ b/pkg/test/dockerutil/dockerutil.go
@@ -88,44 +88,74 @@ func EnsureSupportedDockerVersion() {
// RuntimePath returns the binary path for the current runtime.
func RuntimePath() (string, error) {
+ rs, err := runtimeMap()
+ if err != nil {
+ return "", err
+ }
+
+ p, ok := rs["path"].(string)
+ if !ok {
+ // The runtime does not declare a path.
+ return "", fmt.Errorf("runtime does not declare a path: %v", rs)
+ }
+ return p, nil
+}
+
+// UsingVFS2 returns true if the 'runtime' has the vfs2 flag set.
+// TODO(gvisor.dev/issue/1624): Remove.
+func UsingVFS2() (bool, error) {
+ rMap, err := runtimeMap()
+ if err != nil {
+ return false, err
+ }
+
+ list, ok := rMap["runtimeArgs"].([]interface{})
+ if !ok {
+ return false, fmt.Errorf("unexpected format: %v", rMap)
+ }
+
+ for _, element := range list {
+ if element == "--vfs2" {
+ return true, nil
+ }
+ }
+ return false, nil
+}
+
+func runtimeMap() (map[string]interface{}, error) {
// Read the configuration data; the file must exist.
configBytes, err := ioutil.ReadFile(*config)
if err != nil {
- return "", err
+ return nil, err
}
// Unmarshal the configuration.
c := make(map[string]interface{})
if err := json.Unmarshal(configBytes, &c); err != nil {
- return "", err
+ return nil, err
}
// Decode the expected configuration.
r, ok := c["runtimes"]
if !ok {
- return "", fmt.Errorf("no runtimes declared: %v", c)
+ return nil, fmt.Errorf("no runtimes declared: %v", c)
}
rs, ok := r.(map[string]interface{})
if !ok {
// The runtimes are not a map.
- return "", fmt.Errorf("unexpected format: %v", c)
+ return nil, fmt.Errorf("unexpected format: %v", rs)
}
r, ok = rs[*runtime]
if !ok {
// The expected runtime is not declared.
- return "", fmt.Errorf("runtime %q not found: %v", *runtime, c)
+ return nil, fmt.Errorf("runtime %q not found: %v", *runtime, rs)
}
rs, ok = r.(map[string]interface{})
if !ok {
// The runtime is not a map.
- return "", fmt.Errorf("unexpected format: %v", c)
- }
- p, ok := rs["path"].(string)
- if !ok {
- // The runtime does not declare a path.
- return "", fmt.Errorf("unexpected format: %v", c)
+ return nil, fmt.Errorf("unexpected format: %v", r)
}
- return p, nil
+ return rs, nil
}
// Save exports a container image to the given Writer.
diff --git a/scripts/docker_tests.sh b/scripts/docker_tests.sh
index ce3ffa2eb..4f3867d05 100755
--- a/scripts/docker_tests.sh
+++ b/scripts/docker_tests.sh
@@ -22,7 +22,4 @@ install_runsc_for_test docker
test_runsc //test/image:image_test //test/e2e:integration_test
install_runsc_for_test docker --vfs2
-# Sync with //Makefile.
-IMAGE_FILTER="Hello|Httpd|Ruby|Stdio"
-INTEGRATION_FILTER="LifeCycle|Pause|Connect|JobControl|Overlay|Exec|DirCreation|Link"
-test_runsc //test/e2e:integration_test //test/image:image_test --test_filter="${IMAGE_FILTER}|${INTEGRATION_FILTER}"
+test_runsc //test/e2e:integration_test //test/image:image_test
diff --git a/test/e2e/integration_test.go b/test/e2e/integration_test.go
index 71ec4791e..809244bab 100644
--- a/test/e2e/integration_test.go
+++ b/test/e2e/integration_test.go
@@ -167,6 +167,13 @@ func TestCheckpointRestore(t *testing.T) {
t.Skip("Pause/resume is not supported.")
}
+ // TODO(gvisor.dev/issue/3373): Remove after implementing.
+ if usingVFS2, err := dockerutil.UsingVFS2(); usingVFS2 {
+ t.Skip("CheckpointRestore not implemented in VFS2.")
+ } else if err != nil {
+ t.Fatalf("failed to read config for runtime %s: %v", dockerutil.Runtime(), err)
+ }
+
ctx := context.Background()
d := dockerutil.MakeContainer(ctx, t)
defer d.CleanUp(ctx)