Exemple #1
0
func (s *GaudiTestSuite) TestEnterContainerShouldUseNsEnter(c *C) {
	os.RemoveAll("/var/tmp/gaudi/")

	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()

	// Setup the docker mock package
	docker.MOCK().SetController(ctrl)

	// Setup the util mock package
	util.MOCK().SetController(ctrl)

	// Disable the util package mock
	util.MOCK().DisableMock("IsDir")
	util.MOCK().DisableMock("IsFile")

	util.EXPECT().PrintGreen("Retrieving templates ...")

	images := make(map[string]string)
	images["jpetazzo/nsenter"] = "123"

	docker.EXPECT().ImageExists(gomock.Any()).Return(true).Times(1)
	docker.EXPECT().HasDocker().Return(true).Times(1)
	docker.EXPECT().GetImages().Return(images, nil).Times(1)
	docker.EXPECT().Enter(gomock.Any()).Times(1)

	g := gaudi.Gaudi{}
	g.Init(`
applications:
    app:
        type: apache
`)
	g.Enter("app")
}
func (s *GaudiTestSuite) TestExtendsShouldThrowAnErrorWhenTheElementDoesNotExists(c *C) {
	os.RemoveAll("/var/tmp/gaudi/")

	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()
	docker.MOCK().SetController(ctrl)

	util.MOCK().DisableMock("IsDir")
	util.MOCK().DisableMock("IsFile")
	util.MOCK().DisableMock("LogError")

	disableLog()

	g := gaudi.Gaudi{}

	c.Assert(func() {
		g.Init(`
applications:
    a:
        type: apache
    b:
        extends: c
`)
	}, PanicMatches, "b extends a non existing application : c")

	enableLog()
}
Exemple #3
0
func (s *MaestroTestSuite) TestStartApplicationShouldCleanAndBuildThem(c *C) {
	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()

	// Setup the docker mock package
	docker.MOCK().SetController(ctrl)
	docker.EXPECT().Kill(gomock.Any()).Return().Times(2)
	docker.EXPECT().Remove(gomock.Any()).Return().Times(2)
	docker.EXPECT().Build(gomock.Any(), gomock.Any()).Return().Times(2)
	docker.EXPECT().Start(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("123").Times(2)
	docker.EXPECT().Inspect(gomock.Any()).Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": false}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil).Times(4)

	m := maestro.Maestro{}
	m.InitFromString(`
applications:
    app:
        type: php-fpm
        links: [db]
    db:
        type: mysql
        ports:
            3306: 9000
`, "")

	c.Assert(len(m.Applications), Equals, 2)

	m.Start()
	c.Assert(m.GetContainer("db").IsRunning(), Equals, true)
	c.Assert(m.GetContainer("app").IsRunning(), Equals, true)
}
Exemple #4
0
func (s *MaestroTestSuite) TestInitFromStringShouldCreateAMaestro(c *C) {
	m := maestro.Maestro{}
	m.InitFromString(`
applications:
    app:
        type: php-fpm
        links: [db]
    db:
        type: mysql
        ports:
            3306: 9000
`, "")

	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()
	docker.MOCK().SetController(ctrl)
	docker.EXPECT().Inspect(gomock.Any()).Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": false}, \"NetworkSettings\": {\"IPAddress\": \"\"}}]"), nil)

	c.Assert(len(m.Applications), Equals, 2)
	c.Assert(m.GetContainer("app").Name, Equals, "app")
	c.Assert(m.GetContainer("app").Type, Equals, "php-fpm")
	c.Assert(m.GetContainer("app").Dependencies[0].Name, Equals, "db")
	c.Assert(m.GetContainer("db").GetFirstPort(), Equals, "3306")
	c.Assert(m.GetContainer("db").IsRunning(), Equals, false)
}
func (s *GaudiTestSuite) TestCheckRunningContainerShouldUseDockerPs(c *C) {
	os.RemoveAll("/var/tmp/gaudi/templates/")

	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()

	// Setup the docker mock package
	docker.MOCK().SetController(ctrl)

	// Setup the util mock package
	util.MOCK().SetController(ctrl)

	// Disable the util package mock
	util.MOCK().DisableMock("IsDir")
	util.MOCK().DisableMock("IsFile")

	psResult := make(map[string]string)
	psResult["gaudi/lb"] = "123"
	psResult["gaudi/front1"] = "124"
	psResult["gaudi/db"] = "125"

	util.EXPECT().PrintGreen("Retrieving templates ...").Times(1)

	docker.EXPECT().ImageExists(gomock.Any()).Return(true).Times(1)
	docker.EXPECT().HasDocker().Return(true).Times(1)
	docker.EXPECT().SnapshotProcesses().Return(psResult, nil)

	docker.EXPECT().Inspect("123").Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"123.124.125.126\"}}]"), nil)
	docker.EXPECT().Inspect("124").Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"123.124.125.127\"}}]"), nil)
	docker.EXPECT().Inspect("125").Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"123.124.125.128\"}}]"), nil)

	util.EXPECT().PrintOrange("Application", "lb", "is running", "(123.124.125.126:)")
	util.EXPECT().PrintOrange("Application", "front1", "is running", "(123.124.125.127:)")
	util.EXPECT().PrintOrange("Application", "db", "is running", "(123.124.125.128:3306)")

	g := gaudi.Gaudi{}
	g.Init(`
applications:
    lb:
        links: [front1]
        type: varnish

    front1:
        type: apache

    db:
        type: mysql
        ports:
            3306: 9000
`)

	g.Check()
}
func (s *GaudiTestSuite) TestStartApplicationShouldCleanAndBuildThem(c *C) {
	os.RemoveAll("/var/tmp/gaudi/templates/")

	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()

	// Setup the util mock package
	util.MOCK().SetController(ctrl)

	util.MOCK().DisableMock("IsFile")
	util.MOCK().DisableMock("IsDir")

	// Retrieving templates (1)
	util.EXPECT().PrintGreen(gomock.Any()).Times(1)
	// Killing, Clearing, Building, Starting (3*2)
	util.EXPECT().PrintGreen(gomock.Any(), gomock.Any(), gomock.Any()).Times(6)
	// Started (1*2)
	util.EXPECT().PrintGreen(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(2)

	// Setup the docker mock package
	docker.MOCK().SetController(ctrl)
	docker.EXPECT().ImageExists(gomock.Any()).Return(true).Times(1)
	docker.EXPECT().HasDocker().Return(true).Times(1)
	docker.EXPECT().Kill(gomock.Any()).Return().Times(2)
	docker.EXPECT().Remove(gomock.Any()).Return().Times(2)
	docker.EXPECT().Build(gomock.Any(), gomock.Any()).Return().Times(2)
	docker.EXPECT().Start(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("123").Times(2)
	docker.EXPECT().Inspect(gomock.Any()).Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": false}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil).Times(2)

	g := gaudi.Gaudi{}
	g.Init(`
applications:
    app:
        type: php-fpm
        links: [db]
    db:
        type: mysql
        ports:
            3306: 9000
`)

	c.Assert(len(g.Applications), Equals, 2)

	g.StartApplications(true)
	c.Assert(g.GetApplication("db").IsRunning(), Equals, true)
	c.Assert(g.GetApplication("app").IsRunning(), Equals, true)
}
func (s *GaudiTestSuite) TestExtendsShouldCopyElements(c *C) {
	os.RemoveAll("/var/tmp/gaudi/")

	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()
	docker.MOCK().SetController(ctrl)

	util.MOCK().DisableMock("IsDir")
	util.MOCK().DisableMock("IsFile")

	disableLog()

	docker.EXPECT().ImageExists(gomock.Any()).Return(true).Times(1)
	docker.EXPECT().HasDocker().Return(true).Times(1)

	g := gaudi.Gaudi{}

	g.Init(`
applications:
    a:
        type: apache
        before_script: echo hello
    b:
        extends: a
    c:
        extends: a
        before_script: echo ok
    d:
        extends: c
        type: mysql
`)

	c.Check(g.Applications["a"].Type, Equals, "apache")
	c.Check(g.Applications["b"].BeforeScript, Equals, "echo hello")

	c.Check(g.Applications["b"].Type, Equals, "apache")
	c.Check(g.Applications["b"].BeforeScript, Equals, "echo hello")

	c.Check(g.Applications["c"].Type, Equals, "apache")
	c.Check(g.Applications["c"].BeforeScript, Equals, "echo ok")

	c.Check(g.Applications["d"].Type, Equals, "mysql")
	c.Check(g.Applications["d"].BeforeScript, Equals, "echo ok")

	enableLog()
}
Exemple #8
0
func (s *ContainerTestSuite) TestStartedApplicationShouldRetrieveItsIp(c *C) {
	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()

	// Setup the docker mock package
	docker.MOCK().SetController(ctrl)
	docker.EXPECT().Start(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("123")
	docker.EXPECT().Inspect(gomock.Any()).Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil)

	// @TODO : find a way to mock time.Sleep
	container := container.Container{Name: "Test"}
	container.Start(true)

	c.Check(container.IsRunning(), Equals, true)
	c.Check(container.Ip, Equals, "172.17.0.10")
}
Exemple #9
0
func (s *ContainerTestSuite) TestCallCleanShouldStopTheContainer(c *C) {
	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()

	// Setup the docker mock package
	docker.MOCK().SetController(ctrl)
	docker.EXPECT().Inspect(gomock.Any()).Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": false}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil)
	docker.EXPECT().Kill(gomock.Any()).Return()
	docker.EXPECT().Remove(gomock.Any()).Return()

	done := make(chan bool, 1)
	container := container.Container{Name: "Test"}
	container.Clean(done)
	<-done

	c.Check(container.IsRunning(), Equals, false)
}
func (s *GaudiTestSuite) TestUseCustomTemplateShouldUseIt(c *C) {
	os.RemoveAll("/var/tmp/gaudi/")

	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()
	docker.MOCK().SetController(ctrl)

	// Setup the util mock package
	util.MOCK().SetController(ctrl)

	util.MOCK().EnableMock("IsDir")
	util.MOCK().EnableMock("IsFile")
	util.MOCK().EnableMock("LogError")

	g := gaudi.Gaudi{}
	g.ApplicationDir = "/vagrant"

	docker.EXPECT().HasDocker().Return(true).Times(1)
	docker.EXPECT().ImageExists(gomock.Any()).Return(true).Times(1)

	util.EXPECT().IsDir("/var/tmp/gaudi/templates/").Return(false)
	util.EXPECT().IsFile("/vagrant/.gaudi/version.txt").Return(false)
	util.EXPECT().PrintGreen("Retrieving templates ...")

	util.EXPECT().IsFile("/vagrant/front/Dockerfile").Return(true).Times(3)
	util.EXPECT().LogError("Application 'custom' is not supported. Check http://gaudi.io/components.html for a list of supported applications.").Times(3)

	g.Init(`
applications:
    app:
        type: custom
        template: ./front/Dockerfile

    app2:
        type: custom
        template: front/Dockerfile

    app3:
        type: custom
        template: /vagrant/front/Dockerfile
`)
}
func (s *MaestroTestSuite) TestCheckRunningContainerShouldUseDockerPs(c *C) {
	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()

	// Setup the docker mock package
	docker.MOCK().SetController(ctrl)

	// Setup the mockfmt mock package
	mockfmt.MOCK().SetController(ctrl)

	psResult := make(map[string]string)
	psResult["gaudi/lb"] = "123"
	psResult["gaudi/front1"] = "124"
	psResult["gaudi/db"] = "125"

	docker.EXPECT().SnapshotProcesses().Return(psResult, nil)
	docker.EXPECT().Inspect("123").Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"123.124.125.126\"}}]"), nil)
	docker.EXPECT().Inspect("124").Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"123.124.125.127\"}}]"), nil)
	docker.EXPECT().Inspect("125").Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"123.124.125.128\"}}]"), nil)

	mockfmt.EXPECT().Println("Application", "lb", "is running", "(123.124.125.126:)")
	mockfmt.EXPECT().Println("Application", "front1", "is running", "(123.124.125.127:)")
	mockfmt.EXPECT().Println("Application", "db", "is running", "(123.124.125.128:3306)")

	m := maestro.Maestro{}
	m.InitFromString(`
applications:
    lb:
        links: [front1]
        type: varnish

    front1:
        type: apache

    db:
        type: mysql
        ports:
            3306: 9000
`, "")

	m.Check()
}
func (s *GaudiTestSuite) TestStartBinariesShouldCleanAndBuildThem(c *C) {
	os.RemoveAll("/var/tmp/gaudi/")

	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()

	// Setup the docker mock package
	docker.MOCK().SetController(ctrl)

	// Setup the util mock package
	util.MOCK().SetController(ctrl)

	// Disable the util package mock
	util.MOCK().DisableMock("IsDir")
	util.MOCK().DisableMock("IsFile")

	util.EXPECT().PrintGreen("Retrieving templates ...")

	docker.EXPECT().ImageExists(gomock.Any()).Return(true).Times(1)
	docker.EXPECT().HasDocker().Return(true).Times(1)
	docker.EXPECT().ShouldRebuild(gomock.Any()).Return(true).Times(1)

	util.EXPECT().PrintGreen("Building", "gaudi/npm", "...")
	docker.EXPECT().Build(gomock.Any(), gomock.Any()).Times(1)

	util.EXPECT().PrintGreen("Running", "npm", "update", "...")
	docker.EXPECT().Run(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return().Times(1)

	g := gaudi.Gaudi{}
	g.Init(`
binaries:
    npm:
        type: npm
`)

	c.Assert(len(g.Applications), Equals, 0)
	c.Assert(len(g.Binaries), Equals, 1)

	g.Run("npm", []string{"update"})
}
func (s *GaudiTestSuite) TestInitShouldCreateApplications(c *C) {
	os.RemoveAll("/var/tmp/gaudi/")

	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()
	docker.MOCK().SetController(ctrl)

	// Setup the util mock package
	util.MOCK().SetController(ctrl)

	// Disable the util package mock
	util.MOCK().DisableMock("IsDir")
	util.MOCK().DisableMock("IsFile")

	util.EXPECT().PrintGreen("Retrieving templates ...")

	docker.EXPECT().ImageExists(gomock.Any()).Return(true).Times(1)
	docker.EXPECT().HasDocker().Return(true).Times(1)
	docker.EXPECT().Inspect(gomock.Any()).Return([]byte("[{\"ID\": \"123\", \"State\":{\"Running\": false}, \"NetworkSettings\": {\"IPAddress\": \"\"}}]"), nil)

	g := gaudi.Gaudi{}
	g.Init(`
applications:
    app:
        type: php-fpm
        links: [db]
    db:
        type: mysql
        ports:
            3306: 9000
`)

	c.Assert(len(g.Applications), Equals, 2)
	c.Assert(g.GetApplication("app").Name, Equals, "app")
	c.Assert(g.GetApplication("app").Type, Equals, "php-fpm")
	c.Assert(g.GetApplication("app").Dependencies[0].Name, Equals, "db")
	c.Assert(g.GetApplication("db").GetFirstPort(), Equals, "3306")
	c.Assert(g.GetApplication("db").IsRunning(), Equals, false)
}
func (s *GaudiTestSuite) TestStartApplicationShouldStartThemByOrderOfDependencies(c *C) {
	os.RemoveAll("/var/tmp/gaudi/templates/")

	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()

	// Setup the docker mock package
	docker.MOCK().SetController(ctrl)

	// Setup the util mock package
	util.MOCK().SetController(ctrl)

	// Disable the util package mock
	util.MOCK().DisableMock("IsDir")
	util.MOCK().DisableMock("IsFile")
	util.MOCK().EnableMock("PrintGreen")

	// Retrieving templates (1)
	util.EXPECT().PrintGreen(gomock.Any()).Times(1)
	// Killing, Clearing, Building, Starting (3*5)
	util.EXPECT().PrintGreen(gomock.Any(), gomock.Any(), gomock.Any()).Times(15)
	// Started (1*5)
	util.EXPECT().PrintGreen(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(5)

	docker.EXPECT().ImageExists(gomock.Any()).Return(true).Times(1)
	docker.EXPECT().HasDocker().Return(true).Times(1)
	docker.EXPECT().Kill(gomock.Any()).Return().Times(5)
	docker.EXPECT().Remove(gomock.Any()).Return().Times(5)
	docker.EXPECT().Build(gomock.Any(), gomock.Any()).Return().Times(5)

	gomock.InOrder(
		docker.EXPECT().Start("db", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("100"),
		docker.EXPECT().Inspect("100").Return([]byte("[{\"ID\": \"100\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),

		docker.EXPECT().Start("app", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("101"),
		docker.EXPECT().Inspect("101").Return([]byte("[{\"ID\": \"101\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),

		docker.EXPECT().Start("front1", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("102"),

		docker.EXPECT().Start("front2", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("103"),

		docker.EXPECT().Inspect("102").Return([]byte("[{\"ID\": \"102\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),
		docker.EXPECT().Inspect("103").Return([]byte("[{\"ID\": \"103\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),

		docker.EXPECT().Start("lb", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("104"),
		docker.EXPECT().Inspect("104").Return([]byte("[{\"ID\": \"104\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),
	)

	g := gaudi.Gaudi{}
	g.Init(`
applications:
    lb:
        links: [front1, front2]
        type: varnish

    front1:
        links: [app]
        type: apache

    front2:
        links: [app]
        type: apache

    app:
        links: [db]
        type: php-fpm

    db:
      type: mysql
`)

	g.StartApplications(true)
	c.Assert(len(g.Applications), Equals, 5)
}
Exemple #15
0
func (s *MaestroTestSuite) TestStartApplicationShouldStartThemByOrderOfDependencies(c *C) {
	// Create a gomock controller, and arrange for it's finish to be called
	ctrl := gomock.NewController(c)
	defer ctrl.Finish()

	// Setup the docker mock package
	docker.MOCK().SetController(ctrl)

	m := maestro.Maestro{}
	m.InitFromString(`
applications:
    lb:
        links: [front1, front2]
        type: varnish

    front1:
        links: [app]
        type: apache

    front2:
        links: [app]
        type: apache

    app:
        links: [db]
        type: php-fpm

    db:
      type: mysql
`, "")

	c.Assert(len(m.Applications), Equals, 5)

	docker.EXPECT().Kill(gomock.Any()).Return().Times(5)
	docker.EXPECT().Remove(gomock.Any()).Return().Times(5)
	docker.EXPECT().Build(gomock.Any(), gomock.Any()).Return().Times(5)

	gomock.InOrder(
		docker.EXPECT().Inspect("db").Return([]byte("[{\"ID\": \"100\", \"State\":{\"Running\": false}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),
		docker.EXPECT().Start("db", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("100"),
		docker.EXPECT().Inspect("100").Return([]byte("[{\"ID\": \"100\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),

		docker.EXPECT().Inspect("app").Return([]byte("[{\"ID\": \"101\", \"State\":{\"Running\": false}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),
		docker.EXPECT().Start("app", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("101"),
		docker.EXPECT().Inspect("101").Return([]byte("[{\"ID\": \"101\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),

		docker.EXPECT().Inspect("front1").Return([]byte("[{\"ID\": \"102\", \"State\":{\"Running\": false}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),
		docker.EXPECT().Start("front1", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("102"),

		docker.EXPECT().Inspect("front2").Return([]byte("[{\"ID\": \"103\", \"State\":{\"Running\": false}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),
		docker.EXPECT().Start("front2", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("103"),

		docker.EXPECT().Inspect("102").Return([]byte("[{\"ID\": \"102\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),
		docker.EXPECT().Inspect("103").Return([]byte("[{\"ID\": \"103\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),

		docker.EXPECT().Inspect("lb").Return([]byte("[{\"ID\": \"104\", \"State\":{\"Running\": false}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),
		docker.EXPECT().Start("lb", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("104"),
		docker.EXPECT().Inspect("104").Return([]byte("[{\"ID\": \"104\", \"State\":{\"Running\": true}, \"NetworkSettings\": {\"IPAddress\": \"172.17.0.10\"}}]"), nil),
	)

	m.Start()
}