浏览代码

Remove dependency on 'os/user', which cannot be used with CGO_ENABLED=0. This allows running the tests without CGO.

Solomon Hykes 12 年之前
父节点
当前提交
ce9e50f4ee
共有 1 个文件被更改,包括 3 次插入5 次删除
  1. 3 5
      runtime_test.go

+ 3 - 5
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"