mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Integration generic socket wait for docker api
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
64716a21e4
commit
778f1bf663
3 changed files with 34 additions and 20 deletions
|
@ -1219,8 +1219,6 @@ func ServeApi(job *engine.Job) engine.Status {
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
AcceptConnections(nil)
|
|
||||||
|
|
||||||
for i := 0; i < len(protoAddrs); i += 1 {
|
for i := 0; i < len(protoAddrs); i += 1 {
|
||||||
err := <-chErrors
|
err := <-chErrors
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -78,6 +78,10 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
// load the daemon in the background so we can immediately start
|
||||||
|
// the http api so that connections don't fail while the daemon
|
||||||
|
// is booting
|
||||||
|
go func() {
|
||||||
// Load plugin: httpapi
|
// Load plugin: httpapi
|
||||||
job := eng.Job("initserver")
|
job := eng.Job("initserver")
|
||||||
job.Setenv("Pidfile", *pidfile)
|
job.Setenv("Pidfile", *pidfile)
|
||||||
|
@ -95,8 +99,15 @@ func main() {
|
||||||
if err := job.Run(); err != nil {
|
if err := job.Run(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
// after the daemon is done setting up we can tell the api to start
|
||||||
|
// accepting connections
|
||||||
|
if err := eng.Job("acceptconnections").Run(); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
// Serve api
|
// Serve api
|
||||||
job = eng.Job("serveapi", flHosts.GetAll()...)
|
job := eng.Job("serveapi", flHosts.GetAll()...)
|
||||||
job.SetenvBool("Logging", true)
|
job.SetenvBool("Logging", true)
|
||||||
job.SetenvBool("EnableCors", *flEnableCors)
|
job.SetenvBool("EnableCors", *flEnableCors)
|
||||||
job.Setenv("Version", dockerversion.VERSION)
|
job.Setenv("Version", dockerversion.VERSION)
|
||||||
|
|
|
@ -171,9 +171,14 @@ func spawnGlobalDaemon() {
|
||||||
log.Fatalf("Unable to spawn the test daemon: %s", err)
|
log.Fatalf("Unable to spawn the test daemon: %s", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Give some time to ListenAndServer to actually start
|
// Give some time to ListenAndServer to actually start
|
||||||
// FIXME: use inmem transports instead of tcp
|
// FIXME: use inmem transports instead of tcp
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
|
|
||||||
|
if err := eng.Job("acceptconnections").Run(); err != nil {
|
||||||
|
log.Fatalf("Unable to accept connections for test api: %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: test that ImagePull(json=true) send correct json output
|
// FIXME: test that ImagePull(json=true) send correct json output
|
||||||
|
|
Loading…
Reference in a new issue