Beispiel #1
0
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"})
}
Beispiel #2
0
func (suite *StateSuite) TestGetDNSNamesIgnoresInstancesWithBlankNames(c *gc.C) {
	instances := []instance.Instance{&dnsNameFakeInstance{name: ""}}
	c.Check(common.GetDNSNames(instances), gc.DeepEquals, []string{})
}
Beispiel #3
0
func (suite *StateSuite) TestGetDNSNamesIgnoresInstancesWithoutNames(c *gc.C) {
	instances := []instance.Instance{&dnsNameFakeInstance{err: instance.ErrNoDNSName}}
	c.Check(common.GetDNSNames(instances), gc.DeepEquals, []string{})
}
Beispiel #4
0
func (suite *StateSuite) TestGetDNSNamesIgnoresNils(c *gc.C) {
	c.Check(common.GetDNSNames([]instance.Instance{nil, nil}), gc.DeepEquals, []string{})
}
Beispiel #5
0
func (suite *StateSuite) TestGetDNSNamesAcceptsNil(c *gc.C) {
	result := common.GetDNSNames(nil)
	c.Check(result, gc.DeepEquals, []string{})
}