The other two more complicated. NewAddress always returns an address
with the scope of NetworkUnknown. In that case the results from calling
unit.Public/PrivateAddress were essentially random.
It feels like there are some other footguns in this area.
Should NewAddress/NewAddresses create NetworkUnknown Address values ?
What happens if they leak into the state and back to the client? How
many other places are these things leaking into.
I'd like to explore removing NewAddress/NewAddresses in a followup, if
they are used only for testing (axw), then they are doing us a
disservice.
Reviewers: mp+213195_ code.launchpad. net,
Message:
Please take a look.
Description:
Fix lp 1298703
One failure was a simple list ordering bug.
The other two more complicated. NewAddress always returns an address PrivateAddress were essentially random.
with the scope of NetworkUnknown. In that case the results from calling
unit.Public/
It feels like there are some other footguns in this area.
Should NewAddress/ NewAddresses create NetworkUnknown Address values ?
What happens if they leak into the state and back to the client? How
many other places are these things leaking into.
I'd like to explore removing NewAddress/ NewAddresses in a followup, if
they are used only for testing (axw), then they are doing us a
disservice.
Thanks to Ian and Andrew for their assistance
https:/ /code.launchpad .net/~dave- cheney/ juju-core/ 104-fix- lp-1298703/ +merge/ 213195
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/81720043/
Affected files (+17, -9 lines): test.go
A [revision details]
M state/machine_
M state/unit_test.go
Index: [revision details] 20140327203820- qrgltgfsli0ff9c i
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: state/machine_ test.go machine_ test.go' test.go 2014-03-26 11:34:48 +0000 test.go 2014-03-28 04:37:31 +0000 machine. Addresses( ), gc.DeepEquals, addresses) machine. Addresses( ), jc.SameContents, addresses)
=== modified file 'state/
--- state/machine_
+++ state/machine_
@@ -1225,7 +1225,7 @@
c.Assert(err, gc.IsNil)
err = machine.Refresh()
c.Assert(err, gc.IsNil)
- c.Assert(
+ c.Assert(
}
func (s *MachineSuite) TestSetMachineA ddresses( c *gc.C) {
Index: state/unit_test.go unit_test. go'
=== modified file 'state/
--- state/unit_test.go 2014-03-13 07:54:56 +0000
+++ state/unit_test.go 2014-03-28 04:37:31 +0000
@@ -179,10 +179,13 @@
c.Check(address, gc.Equals, "")
c.Assert(ok, gc.Equals, false)
- addresses := []instance.Address{ NewAddress( "127.0. 0.1"), NewAddress( "8.8.8. 8"), NewAddress( "8.8.8. 8") NetworkPublic NewAddress( "127.0. 0.1") NetworkScope = instance. NetworkCloudLoc al Address{ public, private} SetAddresses( addresses)
- instance.
- instance.
- }
+ public := instance.
+ public.NetworkScope = instance.
+
+ private := instance.
+ private.
+
+ addresses := []instance.
err = machine.
c.Assert(err, gc.IsNil)
@@ -218,10 +221,13 @@
c.Check(address, gc.Equals, "")
c.Assert(ok, gc.Equals, false)
- addresses := []instance.Address{ NewAddress( "127.0. 0.1"), NewAddress( "8.8.8. 8"), NewAddress( "8.8.8. 8") NetworkPublic NewAddress( "127.0. 0.1") NetworkScope = instance. NetworkCloudLoc al Address{ public, private} SetAddresses( addresses)
- instance.
- instance.
- }
+ public := instance.
+ public.NetworkScope = instance.
+
+ private := instance.
+ private.
+
+ addresses := []instance.
err = machine.
c.Assert(err, gc.IsNil)