本文整理汇总了Golang中github.com/marmelab/gaudi/docker.EXPECT函数的典型用法代码示例。如果您正苦于以下问题:Golang EXPECT函数的具体用法?Golang EXPECT怎么用?Golang EXPECT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EXPECT函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestEnterContainerShouldUseNsEnter
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")
}
开发者ID:hungld,项目名称:gaudi,代码行数:35,代码来源:gaudi_unit_test.go
示例2: TestStartApplicationShouldCleanAndBuildThem
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)
}
开发者ID:pborreli,项目名称:gaudi,代码行数:31,代码来源:maestro_unit_test.go
示例3: TestInitFromStringShouldCreateAMaestro
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)
}
开发者ID:pborreli,项目名称:gaudi,代码行数:26,代码来源:maestro_unit_test.go
示例4: TestExtendsShouldCopyElements
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()
}
开发者ID:nidhisarvaiya,项目名称:gaudi,代码行数:47,代码来源:gaudi_unit_test.go
示例5: TestStartedApplicationShouldRetrieveItsIp
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")
}
开发者ID:hungld,项目名称:gaudi,代码行数:17,代码来源:container_test.go
示例6: TestCallCleanShouldStopTheContainer
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)
}
开发者ID:hungld,项目名称:gaudi,代码行数:18,代码来源:container_test.go
示例7: TestUseCustomTemplateShouldUseIt
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
`)
}
开发者ID:nidhisarvaiya,项目名称:gaudi,代码行数:43,代码来源:gaudi_unit_test.go
示例8: TestCheckRunningContainerShouldUseDockerPs
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()
}
开发者ID:jpetitcolas,项目名称:gaudi,代码行数:43,代码来源:maestro_unit_test.go
示例9: TestStartBinariesShouldCleanAndBuildThem
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"})
}
开发者ID:nidhisarvaiya,项目名称:gaudi,代码行数:41,代码来源:gaudi_unit_test.go
示例10: TestInitShouldCreateApplications
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)
}
开发者ID:nidhisarvaiya,项目名称:gaudi,代码行数:40,代码来源:gaudi_unit_test.go
示例11: TestCheckRunningContainerShouldUseDockerPs
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()
}
开发者ID:nidhisarvaiya,项目名称:gaudi,代码行数:54,代码来源:gaudi_unit_test.go
示例12: TestStartApplicationShouldCleanAndBuildThem
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)
}
开发者ID:nidhisarvaiya,项目名称:gaudi,代码行数:48,代码来源:gaudi_unit_test.go
示例13: TestStartApplicationShouldStartThemByOrderOfDependencies
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)
}
开发者ID:nidhisarvaiya,项目名称:gaudi,代码行数:75,代码来源:gaudi_unit_test.go
示例14: TestStartApplicationShouldStartThemByOrderOfDependencies
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()
}
开发者ID:pborreli,项目名称:gaudi,代码行数:62,代码来源:maestro_unit_test.go
注:本文中的github.com/marmelab/gaudi/docker.EXPECT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论