From bad779d02c86a9cf6bdd3b376920093da9441739 Mon Sep 17 00:00:00 2001 From: Jamie Anderson Date: Mon, 8 Mar 2021 19:27:36 +0000 Subject: [PATCH] Skip layer tests that require root Signed-off-by: Jamie Anderson --- layer/layer_test.go | 7 +++++++ layer/layer_unix_test.go | 2 ++ layer/migration_test.go | 3 +++ layer/mount_test.go | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/layer/layer_test.go b/layer/layer_test.go index 9199b9c..abd6bde 100644 --- a/layer/layer_test.go +++ b/layer/layer_test.go @@ -9,6 +9,7 @@ import ( "runtime" "strings" "testing" + "github.com/docker/docker/testutil" "github.com/containerd/continuity/driver" "github.com/docker/docker/daemon/graphdriver" @@ -258,6 +259,7 @@ func assertLayerEqual(t *testing.T, l1, l2 Layer) { } func TestMountAndRegister(t *testing.T) { + testutil.RequiresRoot(t) ls, _, cleanup := newTestStore(t) defer cleanup() @@ -299,6 +301,7 @@ func TestMountAndRegister(t *testing.T) { } func TestLayerRelease(t *testing.T) { + testutil.RequiresRoot(t) // TODO Windows: Figure out why this is failing if runtime.GOOS == "windows" { t.Skip("Failing on Windows") @@ -348,6 +351,7 @@ func TestLayerRelease(t *testing.T) { } func TestStoreRestore(t *testing.T) { + testutil.RequiresRoot(t) // TODO Windows: Figure out why this is failing if runtime.GOOS == "windows" { t.Skip("Failing on Windows") @@ -463,6 +467,7 @@ func TestStoreRestore(t *testing.T) { } func TestTarStreamStability(t *testing.T) { + testutil.RequiresRoot(t) // TODO Windows: Figure out why this is failing if runtime.GOOS == "windows" { t.Skip("Failing on Windows") @@ -656,6 +661,7 @@ func assertReferences(t *testing.T, references ...Layer) { } func TestRegisterExistingLayer(t *testing.T) { + testutil.RequiresRoot(t) ls, _, cleanup := newTestStore(t) defer cleanup() @@ -692,6 +698,7 @@ func TestRegisterExistingLayer(t *testing.T) { } func TestTarStreamVerification(t *testing.T) { + testutil.RequiresRoot(t) // TODO Windows: Figure out why this is failing if runtime.GOOS == "windows" { t.Skip("Failing on Windows") diff --git a/layer/layer_unix_test.go b/layer/layer_unix_test.go index 6830158..fc12af7 100644 --- a/layer/layer_unix_test.go +++ b/layer/layer_unix_test.go @@ -4,6 +4,7 @@ package layer // import "github.com/docker/docker/layer" import ( "testing" + "github.com/docker/docker/testutil" ) func graphDiffSize(ls Store, l Layer) (int64, error) { @@ -18,6 +19,7 @@ func graphDiffSize(ls Store, l Layer) (int64, error) { // Unix as Windows graph driver does not support Changes which is indirectly // invoked by calling DiffSize on the driver func TestLayerSize(t *testing.T) { + testutil.RequiresRoot(t) ls, _, cleanup := newTestStore(t) defer cleanup() diff --git a/layer/migration_test.go b/layer/migration_test.go index 2b5c330..1cb6d0d 100644 --- a/layer/migration_test.go +++ b/layer/migration_test.go @@ -9,6 +9,7 @@ import ( "path/filepath" "runtime" "testing" + "github.com/docker/docker/testutil" "github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/pkg/stringid" @@ -41,6 +42,7 @@ func writeTarSplitFile(name string, tarContent []byte) error { } func TestLayerMigration(t *testing.T) { + testutil.RequiresRoot(t) // TODO Windows: Figure out why this is failing if runtime.GOOS == "windows" { t.Skip("Failing on Windows") @@ -177,6 +179,7 @@ func tarFromFilesInGraph(graph graphdriver.Driver, graphID, parentID string, fil } func TestLayerMigrationNoTarsplit(t *testing.T) { + testutil.RequiresRoot(t) // TODO Windows: Figure out why this is failing if runtime.GOOS == "windows" { t.Skip("Failing on Windows") diff --git a/layer/mount_test.go b/layer/mount_test.go index 3c868b2..c2ea782 100644 --- a/layer/mount_test.go +++ b/layer/mount_test.go @@ -5,6 +5,7 @@ import ( "runtime" "sort" "testing" + "github.com/docker/docker/testutil" "github.com/containerd/continuity/driver" "github.com/docker/docker/pkg/archive" @@ -12,6 +13,7 @@ import ( ) func TestMountInit(t *testing.T) { + testutil.RequiresRoot(t) // TODO Windows: Figure out why this is failing if runtime.GOOS == "windows" { t.Skip("Failing on Windows") @@ -71,6 +73,7 @@ func TestMountInit(t *testing.T) { } func TestMountSize(t *testing.T) { + testutil.RequiresRoot(t) // TODO Windows: Figure out why this is failing if runtime.GOOS == "windows" { t.Skip("Failing on Windows") @@ -120,6 +123,7 @@ func TestMountSize(t *testing.T) { } func TestMountChanges(t *testing.T) { + testutil.RequiresRoot(t) // TODO Windows: Figure out why this is failing if runtime.GOOS == "windows" { t.Skip("Failing on Windows") -- 2.25.0.24.gbc7a3d4