Make integration tests to call the new start and create endpoints.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 002afbbe77abe722b8d0c6a2d3f11a258509f430
Component: engine
This commit is contained in:
David Calavera
2015-04-09 16:29:31 -07:00
parent fa70da1003
commit ea6bddb0de
2 changed files with 31 additions and 36 deletions
+7 -8
View File
@@ -44,16 +44,15 @@ func mkDaemon(f Fataler) *daemon.Daemon {
}
func createNamedTestContainer(eng *engine.Engine, config *runconfig.Config, f Fataler, name string) (shortId string) {
job := eng.Job("create", name)
if err := job.ImportEnv(config); err != nil {
env := new(engine.Env)
if err := env.Import(config); err != nil {
f.Fatal(err)
}
var outputBuffer = bytes.NewBuffer(nil)
job.Stdout.Add(outputBuffer)
if err := job.Run(); err != nil {
containerId, _, err := getDaemon(eng).ContainerCreate(name, env)
if err != nil {
f.Fatal(err)
}
return engine.Tail(outputBuffer, 1)
return containerId
}
func createTestContainer(eng *engine.Engine, config *runconfig.Config, f Fataler) (shortId string) {
@@ -61,8 +60,8 @@ func createTestContainer(eng *engine.Engine, config *runconfig.Config, f Fataler
}
func startContainer(eng *engine.Engine, id string, t Fataler) {
job := eng.Job("start", id)
if err := job.Run(); err != nil {
env := new(engine.Env)
if err := getDaemon(eng).ContainerStart(id, env); err != nil {
t.Fatal(err)
}
}