Exemplo n.º 1
0
func (s *addressesSuite) TestHostAddressIPv6(c *gc.C) {
	addr, err := manual.HostAddress("::1")
	c.Assert(s.netLookupHostCalled, gc.Equals, 0)
	c.Assert(err, gc.IsNil)
	c.Assert(addr, gc.Equals, instance.Address{
		Value:        "::1",
		Type:         instance.Ipv6Address,
		NetworkScope: instance.NetworkPublic,
	})
}
Exemplo n.º 2
0
func (s *addressesSuite) TestHostAddress(c *gc.C) {
	addr, err := manual.HostAddress(validHost)
	c.Assert(s.netLookupHostCalled, gc.Equals, 1)
	c.Assert(err, gc.IsNil)
	c.Assert(addr, gc.Equals, instance.Address{
		Value:        validHost,
		Type:         instance.HostName,
		NetworkScope: instance.NetworkPublic,
	})
}
Exemplo n.º 3
0
func (s *addressesSuite) TestHostAddressError(c *gc.C) {
	addr, err := manual.HostAddress(invalidHost)
	c.Assert(s.netLookupHostCalled, gc.Equals, 1)
	c.Assert(err, gc.ErrorMatches, "invalid host: "+invalidHost)
	c.Assert(addr, gc.Equals, instance.Address{})
}