func (s *UnitSuite) setAssignedMachineAddresses(c *gc.C, u *state.Unit) { err := u.AssignToNewMachine() c.Assert(err, jc.ErrorIsNil) mid, err := u.AssignedMachineId() c.Assert(err, jc.ErrorIsNil) machine, err := s.State.Machine(mid) c.Assert(err, jc.ErrorIsNil) err = machine.SetProvisioned("i-exist", "fake_nonce", nil) c.Assert(err, jc.ErrorIsNil) err = machine.SetProviderAddresses(network.Address{ Type: network.IPv4Address, Scope: network.ScopeCloudLocal, Value: "private.address.example.com", }, network.Address{ Type: network.IPv4Address, Scope: network.ScopePublic, Value: "public.address.example.com", }) c.Assert(err, jc.ErrorIsNil) }