Ubuntu Pastebin

Paste from aim at Tue, 15 Mar 2016 18:38:11 +0000

Download as text
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
diff --git a/provider/maas/instance_test.go b/provider/maas/instance_test.go
index a500ce9..01e0c31 100644
--- a/provider/maas/instance_test.go
+++ b/provider/maas/instance_test.go
@@ -68,7 +68,7 @@ func (s *instanceTest) TestId(c *gc.C) {
 	statusGetter := func(instance.Id) (string, string) {
 		return "unknown", "FAKE"
 	}
-	instance := maasInstance{&obj, statusGetter}
+	instance := maasInstance{&obj, nil, statusGetter}
 
 	c.Check(string(instance.Id()), gc.Equals, resourceURI)
 }
@@ -80,7 +80,7 @@ func (s *instanceTest) TestString(c *gc.C) {
 		return "unknown", "FAKE"
 	}
 
-	instance := &maasInstance{&obj, statusGetter}
+	instance := &maasInstance{&obj, nil, statusGetter}
 	hostname, err := instance.hostname()
 	c.Assert(err, jc.ErrorIsNil)
 	expected := hostname + ":" + string(instance.Id())
@@ -95,7 +95,7 @@ func (s *instanceTest) TestStringWithoutHostname(c *gc.C) {
 		return "unknown", "FAKE"
 	}
 
-	instance := &maasInstance{&obj, statusGetter}
+	instance := &maasInstance{&obj, nil, statusGetter}
 	_, err := instance.hostname()
 	c.Assert(err, gc.NotNil)
 	expected := fmt.Sprintf("<DNSName failed: %q>", err) + ":" + string(instance.Id())
@@ -116,7 +116,7 @@ func (s *instanceTest) TestAddressesLegacy(c *gc.C) {
 		return "unknown", "FAKE"
 	}
 
-	inst := maasInstance{&obj, statusGetter}
+	inst := maasInstance{&obj, s.makeEnviron(), statusGetter}
 
 	expected := []network.Address{
 		network.NewScopedAddress("testing.invalid", network.ScopePublic),
@@ -138,38 +138,38 @@ func (s *instanceTest) TestAddressesViaInterfaces(c *gc.C) {
 	// interface_set for a node. To verify we use interfaces we deliberately put
 	// different items in ip_addresses
 	jsonValue := `{
-			"hostname": "-testing.invalid",
-			"system_id": "system_id",
-            "interface_set" : [
-              { "name": "eth0", "links": [
-                  { "subnet": { "space": "bar", "cidr": "8.7.6.0/24" }, "ip_address": "8.7.6.5" },
-                  { "subnet": { "space": "bar", "cidr": "8.7.6.0/24"  }, "ip_address": "8.7.6.6" }
-              ] },
-              { "name": "eth1", "links": [
-                  { "subnet": { "space": "storage", "cidr": "10.0.1.1/24" }, "ip_address": "10.0.1.1" }
-               ] },
-              { "name": "eth3", "links": [
-                  { "subnet": { "space": "db", "cidr": "fc00::/64" }, "ip_address": "fc00::123" }
-               ] },
-              { "name": "eth4" },
-              { "name": "eth5", "links": [
-                  { "mode": "link-up" }
-               ] }
-           ],
-			"ip_addresses": [ "anything", "foo", "0.1.2.3" ]
-		}`
+    "hostname": "-testing.invalid",
+    "system_id": "system_id",
+    "interface_set" : [
+	{ "name": "eth0", "links": [
+	    { "subnet": { "space": "bar", "cidr": "8.7.6.0/24" }, "ip_address": "8.7.6.5" },
+	    { "subnet": { "space": "bar", "cidr": "8.7.6.0/24"  }, "ip_address": "8.7.6.6" }
+	] },
+	{ "name": "eth1", "links": [
+	    { "subnet": { "space": "storage", "cidr": "10.0.1.1/24" }, "ip_address": "10.0.1.1" }
+	] },
+	{ "name": "eth3", "links": [
+	    { "subnet": { "space": "db", "cidr": "fc00::/64" }, "ip_address": "fc00::123" }
+	] },
+	{ "name": "eth4" },
+	{ "name": "eth5", "links": [
+	    { "mode": "link-up" }
+	] }
+    ],
+    "ip_addresses": [ "anything", "foo", "0.1.2.3" ]
+}`
 	obj := s.testMAASObject.TestServer.NewNode(jsonValue)
 	statusGetter := func(instance.Id) (string, string) {
 		return "unknown", "FAKE"
 	}
 
-	inst := maasInstance{&obj, statusGetter}
 	barSpace := server.NewSpace(spaceJSON(gomaasapi.CreateSpace{Name: "bar"}))
 	storageSpace := server.NewSpace(spaceJSON(gomaasapi.CreateSpace{Name: "storage"}))
 	dbSpace := server.NewSpace(spaceJSON(gomaasapi.CreateSpace{Name: "db"}))
 	server.NewSubnet(s.newSubnet("8.7.6.0/24", "bar", 2))
 	server.NewSubnet(s.newSubnet("10.0.1.1/24", "storage", 3))
 	server.NewSubnet(s.newSubnet("fc00::/64", "db", 4))
+	inst := maasInstance{&obj, s.makeEnviron(), statusGetter}
 
 	// Since gomaasapi treats "interface_set" specially and the only way to
 	// change it is via SetNodeNetworkLink(), which in turn does not allow you
@@ -207,7 +207,7 @@ func (s *instanceTest) TestAddressesMissing(c *gc.C) {
 		return "unknown", "FAKE"
 	}
 
-	inst := maasInstance{&obj, statusGetter}
+	inst := maasInstance{&obj, s.makeEnviron(), statusGetter}
 
 	addr, err := inst.Addresses()
 	c.Assert(err, jc.ErrorIsNil)
@@ -228,7 +228,7 @@ func (s *instanceTest) TestAddressesInvalid(c *gc.C) {
 		return "unknown", "FAKE"
 	}
 
-	inst := maasInstance{&obj, statusGetter}
+	inst := maasInstance{&obj, s.makeEnviron(), statusGetter}
 
 	_, err := inst.Addresses()
 	c.Assert(err, gc.NotNil)
@@ -245,7 +245,7 @@ func (s *instanceTest) TestAddressesInvalidContents(c *gc.C) {
 		return "unknown", "FAKE"
 	}
 
-	inst := maasInstance{&obj, statusGetter}
+	inst := maasInstance{&obj, s.makeEnviron(), statusGetter}
 
 	_, err := inst.Addresses()
 	c.Assert(err, gc.NotNil)
@@ -263,7 +263,7 @@ func (s *instanceTest) TestHardwareCharacteristics(c *gc.C) {
 		return "unknown", "FAKE"
 	}
 
-	inst := maasInstance{&obj, statusGetter}
+	inst := maasInstance{&obj, nil, statusGetter}
 	hc, err := inst.hardwareCharacteristics()
 	c.Assert(err, jc.ErrorIsNil)
 	c.Assert(hc, gc.NotNil)
@@ -283,7 +283,7 @@ func (s *instanceTest) TestHardwareCharacteristicsWithTags(c *gc.C) {
 		return "unknown", "FAKE"
 	}
 
-	inst := maasInstance{&obj, statusGetter}
+	inst := maasInstance{&obj, nil, statusGetter}
 	hc, err := inst.hardwareCharacteristics()
 	c.Assert(err, jc.ErrorIsNil)
 	c.Assert(hc, gc.NotNil)
@@ -307,7 +307,7 @@ func (s *instanceTest) testHardwareCharacteristicsMissing(c *gc.C, json, expect
 		return "unknown", "FAKE"
 	}
 
-	inst := maasInstance{&obj, statusGetter}
+	inst := maasInstance{&obj, nil, statusGetter}
 	_, err := inst.hardwareCharacteristics()
 	c.Assert(err, gc.ErrorMatches, expect)
 }
Download as text