skip-privileged-unit-tests
authorPaul Tagliamonte <paultag@debian.org>
Tue, 12 Jul 2016 14:46:35 +0000 (15:46 +0100)
committerTianon Gravi <tianon@debian.org>
Tue, 12 Jul 2016 14:46:35 +0000 (15:46 +0100)
Gbp-Pq: Name skip-privileged-unit-tests.patch

15 files changed:
daemon/daemon_test.go
daemon/graphdriver/aufs/aufs_test.go
daemon/graphdriver/devmapper/devmapper_test.go
daemon/graphdriver/overlay/overlay_test.go
daemon/graphdriver/vfs/vfs_test.go
pkg/archive/archive_test.go
pkg/archive/archive_unix_test.go
pkg/archive/changes_test.go
pkg/authorization/authz_unix_test.go
pkg/chrootarchive/archive_test.go
pkg/idtools/idtools_unix_test.go
pkg/mount/mount_unix_test.go
pkg/mount/sharedsubtree_linux_test.go
pkg/sysinfo/sysinfo_linux_test.go
volume/local/local_test.go

index 609ed95258c6e10b2ea4c7c2b16895be86ab3a37..921e40079feff083af12e6ee245ad9aceb100b84 100644 (file)
@@ -155,6 +155,10 @@ func TestValidContainerNames(t *testing.T) {
 }
 
 func TestContainerInitDNS(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        tmp, err := ioutil.TempDir("", "docker-container-test-")
        if err != nil {
                t.Fatal(err)
index b0ddf89a2cec0bbe0e40aae7bd31d08869c67b81..c224c310dc6a02183e1a29e1e8fef77cfd8f89f8 100644 (file)
@@ -28,6 +28,10 @@ func init() {
 }
 
 func testInit(dir string, t testing.TB) graphdriver.Driver {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        d, err := Init(dir, nil, nil, nil)
        if err != nil {
                if err == graphdriver.ErrNotSupported {
index 5c2abcefcb71c4f0f28633f3ea84ff0f42d6f383..2159ccf74d0bd551c9806e400057ae4918dc4e02 100644 (file)
@@ -11,50 +11,70 @@ import (
        "github.com/docker/docker/daemon/graphdriver/graphtest"
 )
 
-func init() {
+func shortSkip(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+}
+
+// This avoids creating a new driver for each test if all tests are run
+// Make sure to put new tests between TestDevmapperSetup and TestDevmapperTeardown
+func TestDevmapperSetup(t *testing.T) {
+       shortSkip(t)
+
        // Reduce the size the the base fs and loopback for the tests
        defaultDataLoopbackSize = 300 * 1024 * 1024
        defaultMetaDataLoopbackSize = 200 * 1024 * 1024
        defaultBaseFsSize = 300 * 1024 * 1024
        defaultUdevSyncOverride = true
        if err := graphtest.InitLoopbacks(); err != nil {
-               panic(err)
+               t.Fatal(err)
        }
-}
 
-// This avoids creating a new driver for each test if all tests are run
-// Make sure to put new tests between TestDevmapperSetup and TestDevmapperTeardown
-func TestDevmapperSetup(t *testing.T) {
        graphtest.GetDriver(t, "devicemapper")
 }
 
 func TestDevmapperCreateEmpty(t *testing.T) {
+       shortSkip(t)
+
        graphtest.DriverTestCreateEmpty(t, "devicemapper")
 }
 
 func TestDevmapperCreateBase(t *testing.T) {
+       shortSkip(t)
+
        graphtest.DriverTestCreateBase(t, "devicemapper")
 }
 
 func TestDevmapperCreateSnap(t *testing.T) {
+       shortSkip(t)
+
        graphtest.DriverTestCreateSnap(t, "devicemapper")
 }
 
 func TestDevmapperTeardown(t *testing.T) {
+       shortSkip(t)
+
        graphtest.PutDriver(t)
 }
 
 func TestDevmapperReduceLoopBackSize(t *testing.T) {
+       shortSkip(t)
+
        tenMB := int64(10 * 1024 * 1024)
        testChangeLoopBackSize(t, -tenMB, defaultDataLoopbackSize, defaultMetaDataLoopbackSize)
 }
 
 func TestDevmapperIncreaseLoopBackSize(t *testing.T) {
+       shortSkip(t)
+
        tenMB := int64(10 * 1024 * 1024)
        testChangeLoopBackSize(t, tenMB, defaultDataLoopbackSize+tenMB, defaultMetaDataLoopbackSize+tenMB)
 }
 
 func testChangeLoopBackSize(t *testing.T, delta, expectDataSize, expectMetaDataSize int64) {
+       shortSkip(t)
+
        driver := graphtest.GetDriver(t, "devicemapper").(*graphtest.Driver).Driver.(*graphdriver.NaiveDiffDriver).ProtoDriver.(*Driver)
        defer graphtest.PutDriver(t)
        // make sure data or metadata loopback size are the default size
@@ -83,6 +103,8 @@ func testChangeLoopBackSize(t *testing.T, delta, expectDataSize, expectMetaDataS
 
 // Make sure devices.Lock() has been release upon return from cleanupDeletedDevices() function
 func TestDevmapperLockReleasedDeviceDeletion(t *testing.T) {
+       shortSkip(t)
+
        driver := graphtest.GetDriver(t, "devicemapper").(*graphtest.Driver).Driver.(*graphdriver.NaiveDiffDriver).ProtoDriver.(*Driver)
        defer graphtest.PutDriver(t)
 
index 8dfcd62ed02efbfe807aea69e094869d2c87cddd..f5451d3ab3caeef374805b9c44ec85b5dc6d8b68 100644 (file)
@@ -11,18 +11,30 @@ import (
 // This avoids creating a new driver for each test if all tests are run
 // Make sure to put new tests between TestOverlaySetup and TestOverlayTeardown
 func TestOverlaySetup(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
        graphtest.GetDriver(t, "overlay")
 }
 
 func TestOverlayCreateEmpty(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
        graphtest.DriverTestCreateEmpty(t, "overlay")
 }
 
 func TestOverlayCreateBase(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
        graphtest.DriverTestCreateBase(t, "overlay")
 }
 
 func TestOverlayCreateSnap(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
        graphtest.DriverTestCreateSnap(t, "overlay")
 }
 
index 9ecf21dbaaad4f9b836cf5a8795cd7fe34507645..0902926b059c740e6282787d40612e52a7dc8e1b 100644 (file)
@@ -10,28 +10,42 @@ import (
        "github.com/docker/docker/pkg/reexec"
 )
 
-func init() {
-       reexec.Init()
+func shortSkip(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
 }
 
 // This avoids creating a new driver for each test if all tests are run
 // Make sure to put new tests between TestVfsSetup and TestVfsTeardown
 func TestVfsSetup(t *testing.T) {
+       shortSkip(t)
+
+       reexec.Init()
+
        graphtest.GetDriver(t, "vfs")
 }
 
 func TestVfsCreateEmpty(t *testing.T) {
+       shortSkip(t)
+
        graphtest.DriverTestCreateEmpty(t, "vfs")
 }
 
 func TestVfsCreateBase(t *testing.T) {
+       shortSkip(t)
+
        graphtest.DriverTestCreateBase(t, "vfs")
 }
 
 func TestVfsCreateSnap(t *testing.T) {
+       shortSkip(t)
+
        graphtest.DriverTestCreateSnap(t, "vfs")
 }
 
 func TestVfsTeardown(t *testing.T) {
+       shortSkip(t)
+
        graphtest.PutDriver(t)
 }
index 495cac832c0d33148cfafd00571a507992890337..3c56b0a8a6c9b43ba15391e45f0444a95890cd8a 100644 (file)
@@ -305,6 +305,10 @@ func TestUntarPathWithInvalidSrc(t *testing.T) {
 }
 
 func TestUntarPath(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        tmpFolder, err := ioutil.TempDir("", "docker-archive-test")
        if err != nil {
                t.Fatal(err)
@@ -439,6 +443,10 @@ func TestCopyWithTarInvalidSrc(t *testing.T) {
 }
 
 func TestCopyWithTarInexistentDestWillCreateIt(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        tempFolder, err := ioutil.TempDir("", "docker-archive-test")
        if err != nil {
                t.Fatal(nil)
@@ -923,6 +931,11 @@ func TestUntarHardlinkToSymlink(t *testing.T) {
        if runtime.GOOS == "windows" {
                t.Skip("hardlinks on Windows")
        }
+
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        for i, headers := range [][]*tar.Header{
                {
                        {
index 548391b35dce0fa32e4829e56fe5f2ecb61c6184..2663a74f5f9ebd79cbfe0dfd9808c649a09ff9e8 100644 (file)
@@ -150,6 +150,10 @@ func getInode(path string) (uint64, error) {
 }
 
 func TestTarWithBlockCharFifo(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        origin, err := ioutil.TempDir("", "docker-test-tar-hardlink")
        if err != nil {
                t.Fatal(err)
@@ -203,6 +207,10 @@ func TestTarWithBlockCharFifo(t *testing.T) {
 
 // TestTarUntarWithXattr is Unix as Lsetxattr is not supported on Windows
 func TestTarUntarWithXattr(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        origin, err := ioutil.TempDir("", "docker-test-untar-origin")
        if err != nil {
                t.Fatal(err)
index bca682502da21cd3bddc9201bae8ba75f0672d66..f9846c6d6b3cbeedbf49bcda0a3ebf40c0361ac1 100644 (file)
@@ -142,6 +142,10 @@ func TestChangesWithNoChanges(t *testing.T) {
 }
 
 func TestChangesWithChanges(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        // TODO Windows. There may be a way of running this, but turning off for now
        // as createSampleDir uses symlinks.
        if runtime.GOOS == "windows" {
@@ -198,6 +202,11 @@ func TestChangesWithChangesGH13590(t *testing.T) {
        if runtime.GOOS == "windows" {
                t.Skip("symlinks on Windows")
        }
+
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        baseLayer, err := ioutil.TempDir("", "docker-changes-test.")
        defer os.RemoveAll(baseLayer)
 
index 1c6dc8a125a40d2f9916bfb43d2a32e0fe4417ee..93f2eaecb21d3978e347d3bf5b641ba536bf5854 100644 (file)
@@ -28,6 +28,10 @@ import (
 const pluginAddress = "authzplugin.sock"
 
 func TestAuthZRequestPluginError(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        server := authZPluginTestServer{t: t}
        go server.start()
        defer server.stop()
@@ -59,6 +63,10 @@ func TestAuthZRequestPluginError(t *testing.T) {
 }
 
 func TestAuthZRequestPlugin(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        server := authZPluginTestServer{t: t}
        go server.start()
        defer server.stop()
@@ -91,6 +99,10 @@ func TestAuthZRequestPlugin(t *testing.T) {
 }
 
 func TestAuthZResponsePlugin(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        server := authZPluginTestServer{t: t}
        go server.start()
        defer server.stop()
index 5fbe20843fd14a0a5e3e9a7d923542929c0d24b7..9b60805a4da0ede0e584922a586d0eb42f62d4a0 100644 (file)
@@ -22,7 +22,15 @@ func init() {
        reexec.Init()
 }
 
+func shortSkip(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+}
+
 func TestChrootTarUntar(t *testing.T) {
+       shortSkip(t)
+
        tmpdir, err := ioutil.TempDir("", "docker-TestChrootTarUntar")
        if err != nil {
                t.Fatal(err)
@@ -54,6 +62,8 @@ func TestChrootTarUntar(t *testing.T) {
 // gh#10426: Verify the fix for having a huge excludes list (like on `docker load` with large # of
 // local images)
 func TestChrootUntarWithHugeExcludesList(t *testing.T) {
+       shortSkip(t)
+
        tmpdir, err := ioutil.TempDir("", "docker-TestChrootUntarHugeExcludes")
        if err != nil {
                t.Fatal(err)
@@ -88,6 +98,8 @@ func TestChrootUntarWithHugeExcludesList(t *testing.T) {
 }
 
 func TestChrootUntarEmptyArchive(t *testing.T) {
+       shortSkip(t)
+
        tmpdir, err := ioutil.TempDir("", "docker-TestChrootUntarEmptyArchive")
        if err != nil {
                t.Fatal(err)
@@ -152,6 +164,8 @@ func compareFiles(src string, dest string) error {
 }
 
 func TestChrootTarUntarWithSymlink(t *testing.T) {
+       shortSkip(t)
+
        // TODO Windows: Figure out why this is failing
        if runtime.GOOS == "windows" {
                t.Skip("Failing on Windows")
@@ -178,6 +192,8 @@ func TestChrootTarUntarWithSymlink(t *testing.T) {
 }
 
 func TestChrootCopyWithTar(t *testing.T) {
+       shortSkip(t)
+
        // TODO Windows: Figure out why this is failing
        if runtime.GOOS == "windows" {
                t.Skip("Failing on Windows")
@@ -228,6 +244,8 @@ func TestChrootCopyWithTar(t *testing.T) {
 }
 
 func TestChrootCopyFileWithTar(t *testing.T) {
+       shortSkip(t)
+
        tmpdir, err := ioutil.TempDir("", "docker-TestChrootCopyFileWithTar")
        if err != nil {
                t.Fatal(err)
@@ -271,6 +289,8 @@ func TestChrootCopyFileWithTar(t *testing.T) {
 }
 
 func TestChrootUntarPath(t *testing.T) {
+       shortSkip(t)
+
        // TODO Windows: Figure out why this is failing
        if runtime.GOOS == "windows" {
                t.Skip("Failing on Windows")
@@ -336,6 +356,8 @@ func (s *slowEmptyTarReader) Read(p []byte) (int, error) {
 }
 
 func TestChrootUntarEmptyArchiveFromSlowReader(t *testing.T) {
+       shortSkip(t)
+
        tmpdir, err := ioutil.TempDir("", "docker-TestChrootUntarEmptyArchiveFromSlowReader")
        if err != nil {
                t.Fatal(err)
@@ -352,6 +374,8 @@ func TestChrootUntarEmptyArchiveFromSlowReader(t *testing.T) {
 }
 
 func TestChrootApplyEmptyArchiveFromSlowReader(t *testing.T) {
+       shortSkip(t)
+
        tmpdir, err := ioutil.TempDir("", "docker-TestChrootApplyEmptyArchiveFromSlowReader")
        if err != nil {
                t.Fatal(err)
@@ -368,6 +392,8 @@ func TestChrootApplyEmptyArchiveFromSlowReader(t *testing.T) {
 }
 
 func TestChrootApplyDotDotFile(t *testing.T) {
+       shortSkip(t)
+
        tmpdir, err := ioutil.TempDir("", "docker-TestChrootApplyDotDotFile")
        if err != nil {
                t.Fatal(err)
index 540d3079ee2347126045d0b719bf72d10828ba0e..14e0c82ec60c194323572d0c53c3a72b20da98c6 100644 (file)
@@ -17,6 +17,10 @@ type node struct {
 }
 
 func TestMkdirAllAs(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        dirName, err := ioutil.TempDir("", "mkdirall")
        if err != nil {
                t.Fatalf("Couldn't create temp dir: %v", err)
@@ -77,6 +81,9 @@ func TestMkdirAllAs(t *testing.T) {
 }
 
 func TestMkdirAllNewAs(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
 
        dirName, err := ioutil.TempDir("", "mkdirnew")
        if err != nil {
@@ -137,6 +144,9 @@ func TestMkdirAllNewAs(t *testing.T) {
 }
 
 func TestMkdirAs(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
 
        dirName, err := ioutil.TempDir("", "mkdir")
        if err != nil {
index d45fbc1b898e873e96e9b0ca99afbafcae798665..378e3d211d5208a9da80ae92a5c77f9ff14824fe 100644 (file)
@@ -25,6 +25,10 @@ func TestMountOptionsParsing(t *testing.T) {
 }
 
 func TestMounted(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        tmp := path.Join(os.TempDir(), "mount-tests")
        if err := os.MkdirAll(tmp, 0777); err != nil {
                t.Fatal(err)
@@ -76,6 +80,10 @@ func TestMounted(t *testing.T) {
 }
 
 func TestMountReadonly(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        tmp := path.Join(os.TempDir(), "mount-tests")
        if err := os.MkdirAll(tmp, 0777); err != nil {
                t.Fatal(err)
@@ -121,6 +129,9 @@ func TestMountReadonly(t *testing.T) {
 }
 
 func TestGetMounts(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
        mounts, err := GetMounts()
        if err != nil {
                t.Fatal(err)
index c1837942e3a98984dce23b5ed0860aa6ea29336e..19c65ccf6bbd659f3f25fcc441db0785493c8b1c 100644 (file)
@@ -11,6 +11,10 @@ import (
 
 // nothing is propagated in or out
 func TestSubtreePrivate(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        tmp := path.Join(os.TempDir(), "mount-tests")
        if err := os.MkdirAll(tmp, 0777); err != nil {
                t.Fatal(err)
@@ -109,6 +113,10 @@ func TestSubtreePrivate(t *testing.T) {
 // Testing that when a target is a shared mount,
 // then child mounts propagate to the source
 func TestSubtreeShared(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        tmp := path.Join(os.TempDir(), "mount-tests")
        if err := os.MkdirAll(tmp, 0777); err != nil {
                t.Fatal(err)
@@ -177,6 +185,10 @@ func TestSubtreeShared(t *testing.T) {
 // testing that mounts to a shared source show up in the slave target,
 // and that mounts into a slave target do _not_ show up in the shared source
 func TestSubtreeSharedSlave(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        tmp := path.Join(os.TempDir(), "mount-tests")
        if err := os.MkdirAll(tmp, 0777); err != nil {
                t.Fatal(err)
@@ -281,6 +293,10 @@ func TestSubtreeSharedSlave(t *testing.T) {
 }
 
 func TestSubtreeUnbindable(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        tmp := path.Join(os.TempDir(), "mount-tests")
        if err := os.MkdirAll(tmp, 0777); err != nil {
                t.Fatal(err)
index fae0fdffbbffc40745f97edd31202efcc08eb921..26802d327b45a2fc926319c6eab461844b6613fa 100644 (file)
@@ -9,6 +9,10 @@ import (
 )
 
 func TestReadProcBool(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        tmpDir, err := ioutil.TempDir("", "test-sysinfo-proc")
        if err != nil {
                t.Fatal(err)
index 1baa085457e7c4e714a4d112ee92ac983093f8cf..94d6b618f819880520cc2e31dcd0a4f844eb3bdf 100644 (file)
@@ -11,6 +11,9 @@ import (
 )
 
 func TestRemove(t *testing.T) {
+       if testing.Short() { t.Skip("Skipping privileged test in short mode")
+       }
+
        // TODO Windows: Investigate why this test fails on Windows under CI
        //               but passes locally.
        if runtime.GOOS == "windows" {
@@ -58,6 +61,10 @@ func TestRemove(t *testing.T) {
 }
 
 func TestInitializeWithVolumes(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        rootDir, err := ioutil.TempDir("", "local-volume-test")
        if err != nil {
                t.Fatal(err)
@@ -90,6 +97,10 @@ func TestInitializeWithVolumes(t *testing.T) {
 }
 
 func TestCreate(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        rootDir, err := ioutil.TempDir("", "local-volume-test")
        if err != nil {
                t.Fatal(err)
@@ -156,6 +167,10 @@ func TestValidateName(t *testing.T) {
 }
 
 func TestCreateWithOpts(t *testing.T) {
+       if testing.Short() {
+               t.Skip("Skipping privileged test in short mode")
+       }
+
        if runtime.GOOS == "windows" {
                t.Skip()
        }