From ce9e50f4eeed9ec9d715d805ae6706ed6f28da3b Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Fri, 21 Jun 2013 19:40:42 -0700 Subject: [PATCH] Remove dependency on 'os/user', which cannot be used with CGO_ENABLED=0. This allows running the tests without CGO. --- runtime_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/runtime_test.go b/runtime_test.go index db6367dfaf..da037d7105 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -8,10 +8,10 @@ import ( "log" "net" "os" - "os/user" "strconv" "strings" "sync" + "syscall" "testing" "time" ) @@ -49,10 +49,8 @@ func init() { return } - if usr, err := user.Current(); err != nil { - panic(err) - } else if usr.Uid != "0" { - panic("docker tests needs to be run as root") + if uid := syscall.Geteuid(); uid != 0 { + log.Fatal("docker tests needs to be run as root") } NetworkBridgeIface = "testdockbr0"