mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00: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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user