本文整理汇总了Golang中github.com/pivotal-cf-experimental/bosh-test/bosh.Client.Deployments方法的典型用法代码示例。如果您正苦于以下问题:Golang Client.Deployments方法的具体用法?Golang Client.Deployments怎么用?Golang Client.Deployments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pivotal-cf-experimental/bosh-test/bosh.Client
的用法示例。
在下文中一共展示了Client.Deployments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: VerifyDeploymentRelease
func VerifyDeploymentRelease(client bosh.Client, deploymentName string, releaseVersion string) (err error) {
deployments, err := client.Deployments()
if err != nil {
return
}
for _, deployment := range deployments {
if deployment.Name == deploymentName {
for _, release := range deployment.Releases {
if release.Name == "consul" {
switch {
case len(release.Versions) > 1:
err = errors.New("too many releases")
case len(release.Versions) == 1 && release.Versions[0] != releaseVersion:
err = fmt.Errorf("expected consul-release version %q but got %q", releaseVersion, release.Versions[0])
}
}
}
}
}
return
}
示例2:
Expect(err).NotTo(HaveOccurred())
config, err = helpers.LoadConfig(configPath)
Expect(err).NotTo(HaveOccurred())
client = bosh.NewClient(bosh.Config{
URL: fmt.Sprintf("https://%s:25555", config.BOSH.Target),
Username: config.BOSH.Username,
Password: config.BOSH.Password,
AllowInsecureSSL: true,
})
})
var _ = Describe("precheck", func() {
It("confirms that there are no conflicting deployments", func() {
deployments, err := client.Deployments()
Expect(err).NotTo(HaveOccurred())
for _, deployment := range deployments {
for _, name := range []string{"consul", "turbulence-consul"} {
ok, err := MatchRegexp(fmt.Sprintf("%s-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}", name)).Match(deployment.Name)
if err != nil {
Fail(err.Error())
}
if ok {
Fail(fmt.Sprintf("existing deployment %s", deployment.Name))
}
}
}
})