Exemplo n.º 1
0
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)
}
Exemplo n.º 2
0
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)
}
Exemplo n.º 3
0
func (s *SpacesSuite) removeSpaceAndAssertNotFound(c *gc.C, space *state.Space) {
	err := space.Remove()
	c.Assert(err, jc.ErrorIsNil)
	s.assertSpaceNotFound(c, space.Name())
}
Exemplo n.º 4
0
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)
}
Exemplo n.º 5
0
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)
}