本文整理汇总了Golang中github.com/marmelab/gaudi/container.Container类的典型用法代码示例。如果您正苦于以下问题:Golang Container类的具体用法?Golang Container怎么用?Golang Container使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Container类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: extendsOne
func extendsOne(child, parent *container.Container, extendsChan map[string]chan bool) {
// Waiting for dependencies to be extended
<-extendsChan[parent.Name]
// Extends the application
child.ExtendsContainer(parent)
close(extendsChan[child.Name])
}
开发者ID:hungld,项目名称:gaudi,代码行数:8,代码来源:gaudi.go
示例2: startContainer
func (maestro *Maestro) startContainer(currentContainer *container.Container, done map[string]chan bool) {
// Waiting for dependencies to start
for _, dependency := range currentContainer.Dependencies {
<-done[dependency.Name]
}
currentContainer.Start()
close(done[currentContainer.Name])
}
开发者ID:pborreli,项目名称:gaudi,代码行数:10,代码来源:maestro.go
示例3: TestGetFirstPortShouldReturnTheFirstDeclaredPort
func (s *ContainerTestSuite) TestGetFirstPortShouldReturnTheFirstDeclaredPort(c *C) {
container := container.Container{Name: "Test"}
c.Check(container.GetFirstPort(), Equals, "")
container.Ports = make(map[string]string)
container.Ports["80"] = "8080"
container.Ports["9000"] = "9000"
c.Check(container.GetFirstPort(), Equals, "80")
}
开发者ID:hungld,项目名称:gaudi,代码行数:11,代码来源:container_test.go
示例4: startOne
func startOne(currentContainer *container.Container, rebuild bool, done map[string]chan bool) {
// Waiting for dependencies to be started
for _, dependency := range currentContainer.Dependencies {
if dependency.Name == currentContainer.Name {
util.LogError("Application " + currentContainer.Name + " can't be linked with itself.")
}
<-done[dependency.Name]
}
currentContainer.Start(rebuild)
close(done[currentContainer.Name])
}
开发者ID:hungld,项目名称:gaudi,代码行数:14,代码来源:containerCollection.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: TestContainerWithReadyDependenciesShouldBeReady
func (s *ContainerTestSuite) TestContainerWithReadyDependenciesShouldBeReady(c *C) {
dep1 := container.Container{Name: "abc"}
dep1.Running = false
dep2 := container.Container{Name: "abc"}
dep2.Running = true
mainContainer := container.Container{Name: "Test"}
mainContainer.Dependencies = make([]*container.Container, 0)
mainContainer.AddDependency(&dep1)
mainContainer.AddDependency(&dep2)
c.Check(mainContainer.IsReady(), Equals, false)
dep1.Running = true
c.Check(mainContainer.IsReady(), Equals, true)
}
开发者ID:hungld,项目名称:gaudi,代码行数:18,代码来源:container_test.go
注:本文中的github.com/marmelab/gaudi/container.Container类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论