本文整理汇总了Golang中github.com/juju/juju/state.Space.Life方法的典型用法代码示例。如果您正苦于以下问题:Golang Space.Life方法的具体用法?Golang Space.Life怎么用?Golang Space.Life使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/state.Space
的用法示例。
在下文中一共展示了Space.Life方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: assertSpace
func assertSpace(c *gc.C, space *state.Space, name string, subnets []string, isPublic bool) {
c.Assert(space.Name(), gc.Equals, name)
actualSubnets, err := space.Subnets()
c.Assert(err, jc.ErrorIsNil)
actualSubnetIds := make([]string, len(actualSubnets))
for i, subnet := range actualSubnets {
actualSubnetIds[i] = subnet.CIDR()
}
c.Assert(actualSubnetIds, jc.SameContents, subnets)
c.Assert(state.SpaceDoc(space).IsPublic, gc.Equals, isPublic)
c.Assert(space.Life(), gc.Equals, state.Alive)
c.Assert(strings.HasSuffix(space.ID(), name), jc.IsTrue)
c.Assert(space.String(), gc.Equals, name)
}
示例2: assertSpaceMatchesArgs
func (s *SpacesSuite) assertSpaceMatchesArgs(c *gc.C, space *state.Space, args addSpaceArgs) {
c.Assert(space.Name(), gc.Equals, args.Name)
c.Assert(space.ProviderId(), gc.Equals, args.ProviderId)
actualSubnets, err := space.Subnets()
c.Assert(err, jc.ErrorIsNil)
actualSubnetIds := make([]string, len(actualSubnets))
for i, subnet := range actualSubnets {
actualSubnetIds[i] = subnet.CIDR()
}
c.Assert(actualSubnetIds, jc.SameContents, args.SubnetCIDRs)
c.Assert(state.SpaceDoc(space).IsPublic, gc.Equals, args.IsPublic)
c.Assert(space.Life(), gc.Equals, state.Alive)
c.Assert(space.String(), gc.Equals, args.Name)
}
示例3: refreshAndAssertSpaceLifeIs
func (s *SpacesSuite) refreshAndAssertSpaceLifeIs(c *gc.C, space *state.Space, expectedLife state.Life) {
err := space.Refresh()
c.Assert(err, jc.ErrorIsNil)
c.Assert(space.Life(), gc.Equals, expectedLife)
}
示例4: ensureDeadAndAssertLifeIsDead
func (s *SpacesSuite) ensureDeadAndAssertLifeIsDead(c *gc.C, space *state.Space) {
err := space.EnsureDead()
c.Assert(err, jc.ErrorIsNil)
c.Assert(space.Life(), gc.Equals, state.Dead)
}