func (suite *StateSuite) TestGetDNSNamesReturnsNames(c *gc.C) { instances := []instance.Instance{ &dnsNameFakeInstance{name: "foo"}, &dnsNameFakeInstance{name: "bar"}, } c.Check(common.GetDNSNames(instances), gc.DeepEquals, []string{"foo", "bar"}) }
func (suite *StateSuite) TestGetDNSNamesIgnoresInstancesWithBlankNames(c *gc.C) { instances := []instance.Instance{&dnsNameFakeInstance{name: ""}} c.Check(common.GetDNSNames(instances), gc.DeepEquals, []string{}) }
func (suite *StateSuite) TestGetDNSNamesIgnoresInstancesWithoutNames(c *gc.C) { instances := []instance.Instance{&dnsNameFakeInstance{err: instance.ErrNoDNSName}} c.Check(common.GetDNSNames(instances), gc.DeepEquals, []string{}) }
func (suite *StateSuite) TestGetDNSNamesIgnoresNils(c *gc.C) { c.Check(common.GetDNSNames([]instance.Instance{nil, nil}), gc.DeepEquals, []string{}) }
func (suite *StateSuite) TestGetDNSNamesAcceptsNil(c *gc.C) { result := common.GetDNSNames(nil) c.Check(result, gc.DeepEquals, []string{}) }