mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
daemon unit tests: skip some if non-root
This prevents the following test case failures "go test" is run as non-root in the daemon/ directory: > --- FAIL: TestContainerInitDNS (0.02s) > daemon_test.go:209: chown /tmp/docker-container-test-054812199/volumes: operation not permitted > > --- FAIL: TestDaemonReloadNetworkDiagnosticPort (0.00s) > reload_test.go:525: mkdir /var/lib/docker/network/files/: permission denied > --- FAIL: TestRootMountCleanup (0.00s) > daemon_linux_test.go:240: assertion failed: error is not nil: operation not permitted Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
9bd5d9912f
commit
16670ed484
3 changed files with 12 additions and 0 deletions
|
@ -229,6 +229,10 @@ func checkMounted(t *testing.T, p string, expect bool) {
|
|||
}
|
||||
|
||||
func TestRootMountCleanup(t *testing.T) {
|
||||
if os.Getuid() != 0 {
|
||||
t.Skip("root required")
|
||||
}
|
||||
|
||||
t.Parallel()
|
||||
|
||||
testRoot, err := ioutil.TempDir("", t.Name())
|
||||
|
|
|
@ -153,6 +153,10 @@ func TestValidContainerNames(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestContainerInitDNS(t *testing.T) {
|
||||
if os.Getuid() != 0 {
|
||||
t.Skip("root required") // for chown
|
||||
}
|
||||
|
||||
tmp, err := ioutil.TempDir("", "docker-container-test-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package daemon // import "github.com/docker/docker/daemon"
|
||||
|
||||
import (
|
||||
"os"
|
||||
"reflect"
|
||||
"sort"
|
||||
"testing"
|
||||
|
@ -499,6 +500,9 @@ func TestDaemonDiscoveryReloadOnlyClusterAdvertise(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDaemonReloadNetworkDiagnosticPort(t *testing.T) {
|
||||
if os.Getuid() != 0 {
|
||||
t.Skip("root required")
|
||||
}
|
||||
daemon := &Daemon{
|
||||
imageService: images.NewImageService(images.ImageServiceConfig{}),
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue