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
This commit is contained in:
Zach Koopmans
2020-08-11 10:37:32 -07:00
committed by gVisor bot
parent 8e31f0dc57
commit 89f3197fc3
4 changed files with 51 additions and 21 deletions
+1 -5
View File
@@ -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
+42 -12
View File
@@ -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)
return nil, fmt.Errorf("unexpected format: %v", r)
}
p, ok := rs["path"].(string)
if !ok {
// The runtime does not declare a path.
return "", fmt.Errorf("unexpected format: %v", c)
}
return p, nil
return rs, nil
}
// Save exports a container image to the given Writer.
+1 -4
View File
@@ -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
+7
View File
@@ -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)