|
@@ -8,6 +8,7 @@ import (
|
|
"log"
|
|
"log"
|
|
"net"
|
|
"net"
|
|
"os"
|
|
"os"
|
|
|
|
+ "runtime"
|
|
"strconv"
|
|
"strconv"
|
|
"strings"
|
|
"strings"
|
|
"sync"
|
|
"sync"
|
|
@@ -25,7 +26,11 @@ const (
|
|
testDaemonProto = "tcp"
|
|
testDaemonProto = "tcp"
|
|
)
|
|
)
|
|
|
|
|
|
-var globalRuntime *Runtime
|
|
|
|
|
|
+var (
|
|
|
|
+ globalRuntime *Runtime
|
|
|
|
+ startFds int
|
|
|
|
+ startGoroutines int
|
|
|
|
+)
|
|
|
|
|
|
func nuke(runtime *Runtime) error {
|
|
func nuke(runtime *Runtime) error {
|
|
var wg sync.WaitGroup
|
|
var wg sync.WaitGroup
|
|
@@ -80,21 +85,21 @@ func init() {
|
|
NetworkBridgeIface = unitTestNetworkBridge
|
|
NetworkBridgeIface = unitTestNetworkBridge
|
|
|
|
|
|
// Make it our Store root
|
|
// Make it our Store root
|
|
- runtime, err := NewRuntimeFromDirectory(unitTestStoreBase, false)
|
|
|
|
- if err != nil {
|
|
|
|
|
|
+ if runtime, err := NewRuntimeFromDirectory(unitTestStoreBase, false); err != nil {
|
|
panic(err)
|
|
panic(err)
|
|
|
|
+ } else {
|
|
|
|
+ globalRuntime = runtime
|
|
}
|
|
}
|
|
- globalRuntime = runtime
|
|
|
|
|
|
|
|
// Create the "Server"
|
|
// Create the "Server"
|
|
srv := &Server{
|
|
srv := &Server{
|
|
- runtime: runtime,
|
|
|
|
|
|
+ runtime: globalRuntime,
|
|
enableCors: false,
|
|
enableCors: false,
|
|
pullingPool: make(map[string]struct{}),
|
|
pullingPool: make(map[string]struct{}),
|
|
pushingPool: make(map[string]struct{}),
|
|
pushingPool: make(map[string]struct{}),
|
|
}
|
|
}
|
|
// If the unit test is not found, try to download it.
|
|
// If the unit test is not found, try to download it.
|
|
- if img, err := runtime.repositories.LookupImage(unitTestImageName); err != nil || img.ID != unitTestImageID {
|
|
|
|
|
|
+ if img, err := globalRuntime.repositories.LookupImage(unitTestImageName); err != nil || img.ID != unitTestImageID {
|
|
// Retrieve the Image
|
|
// Retrieve the Image
|
|
if err := srv.ImagePull(unitTestImageName, "", os.Stdout, utils.NewStreamFormatter(false), nil); err != nil {
|
|
if err := srv.ImagePull(unitTestImageName, "", os.Stdout, utils.NewStreamFormatter(false), nil); err != nil {
|
|
panic(err)
|
|
panic(err)
|
|
@@ -109,6 +114,8 @@ func init() {
|
|
|
|
|
|
// Give some time to ListenAndServer to actually start
|
|
// Give some time to ListenAndServer to actually start
|
|
time.Sleep(time.Second)
|
|
time.Sleep(time.Second)
|
|
|
|
+
|
|
|
|
+ startFds, startGoroutines = utils.GetTotalUsedFds(), runtime.NumGoroutine()
|
|
}
|
|
}
|
|
|
|
|
|
// FIXME: test that ImagePull(json=true) send correct json output
|
|
// FIXME: test that ImagePull(json=true) send correct json output
|