示例#1
0
func (suite *StateSuite) TestGetDNSNamesReturnsNames(c *C) {
	instances := []instance.Instance{
		&dnsNameFakeInstance{name: "foo"},
		&dnsNameFakeInstance{name: "bar"},
	}

	c.Check(environs.GetDNSNames(instances), DeepEquals, []string{"foo", "bar"})
}
示例#2
0
func (suite *StateSuite) TestGetDNSNamesIgnoresInstancesWithBlankNames(c *C) {
	instances := []instance.Instance{&dnsNameFakeInstance{name: ""}}
	c.Check(environs.GetDNSNames(instances), DeepEquals, []string{})
}
示例#3
0
func (suite *StateSuite) TestGetDNSNamesIgnoresInstancesWithoutNames(c *C) {
	instances := []instance.Instance{&dnsNameFakeInstance{err: instance.ErrNoDNSName}}
	c.Check(environs.GetDNSNames(instances), DeepEquals, []string{})
}
示例#4
0
func (suite *StateSuite) TestGetDNSNamesIgnoresNils(c *C) {
	c.Check(environs.GetDNSNames([]instance.Instance{nil, nil}), DeepEquals, []string{})
}
示例#5
0
func (suite *StateSuite) TestGetDNSNamesAcceptsNil(c *C) {
	result := environs.GetDNSNames(nil)
	c.Check(result, DeepEquals, []string{})
}