本文整理汇总了Golang中github.com/marmelab/gaudi/gaudi.Gaudi.Check方法的典型用法代码示例。如果您正苦于以下问题:Golang Gaudi.Check方法的具体用法?Golang Gaudi.Check怎么用?Golang Gaudi.Check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/marmelab/gaudi/gaudi.Gaudi
的用法示例。
在下文中一共展示了Gaudi.Check方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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()
}
示例2: main
func main() {
flag.Parse()
if *flagVersion {
fmt.Println(gaudi.VERSION)
return
}
rebuild := len(flag.Args()) > 0 && flag.Args()[0] == "rebuild"
g := gaudi.Gaudi{}
g.InitFromFile(retrieveConfigPath(*config))
if len(flag.Args()) == 0 || rebuild {
// Start all applications
g.StartApplications(rebuild)
} else {
switch os.Args[1] {
case "run":
// Run a specific command
g.Run(os.Args[2], os.Args[3:])
break
case "enter":
// Enter in a specific container
g.Enter(os.Args[2])
break
case "stop":
// Stop all applications
g.StopApplications()
break
case "check":
// Check if all applications are running
g.Check()
break
case "clean":
// Clean application containers
g.Clean()
break
default:
util.LogError("Argument " + os.Args[1] + " was not found")
break
}
}
}