func (inst manualBootstrapInstance) Addresses() (addresses []network.Address, err error) { addr, err := manual.HostAddress(inst.host) if err != nil { return nil, err } return []network.Address{addr}, nil }
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, network.Address{ Value: "::1", Type: network.IPv6Address, Scope: network.ScopePublic, }) }
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, network.Address{ Value: validHost, Type: network.HostName, Scope: network.ScopePublic, }) }
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, network.Address{}) }