Merge lp:~allenap/gwacl/add-virtual-network into lp:gwacl

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 206
Merged at revision: 180
Proposed branch: lp:~allenap/gwacl/add-virtual-network
Merge into: lp:gwacl
Diff against target: 427 lines (+337/-24)
5 files modified
example/management/run.go (+9/-21)
management.go (+53/-0)
management_base_test.go (+11/-2)
management_test.go (+264/-0)
xmlobjects.go (+0/-1)
To merge this branch: bzr merge lp:~allenap/gwacl/add-virtual-network
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+174382@code.launchpad.net

Commit message

Two new methods, {Add,Remove}VirtualNetworkSite.

To post a comment you must log in.
202. By Gavin Panella

Remove early return.

Revision history for this message
Raphaël Badin (rvb) wrote :

Looks generally good but I've got a question (see [0]).

[0]

76 + for _, existingSite := range *networkConfig.VirtualNetworkSites {
77 + if existingSite.Name == site.Name {
78 + // Network already defined.
79 + return nil
80 + }

That's a weird behavior don't you think? Say I try adding a network with the same name but a different affinity group; the method will return with a nil error so I'll think that everything is ok and it will be a lie :). I /think/ returning an error (maybe only if the network you're trying to add has exactly the same characteristics as the one with the same name which already exists) is more appropriate here. What do you think?

[1]

102 + for _, existingSite := range *networkConfig.VirtualNetworkSites {
103 + if existingSite.Name != siteName {
104 + virtualNetworkSites = append(virtualNetworkSites, existingSite)
105 + }

We cannot just remove the network in question from networkConfig.VirtualNetworkSites can we :/

[2]

208 + virtualNetwork := &VirtualNetworkSite{Name: MakeRandomVirtualNetworkName("test-")}
209 + err := api.AddVirtualNetworkSite(virtualNetwork)
210 + c.Assert(err, IsNil)
211 + c.Check(record, HasLen, 2)

It's a detail but that's something Jeroen and I have tried to do in tests, especially when the tests are long: put a empty line between the initialization code and the method you're testing, and another after that. This way, we have 3 visually well-separated blocks: initialization, method call, checks.

[3]

You could add a check in example/management/run.go to make sure that the created machine effectively has an IP in the virtual network.

review: Needs Information
203. By Gavin Panella

Simplify AddVirtualNetworkSite (courtesy of jtv).

204. By Gavin Panella

Throw a wobbly when a virtual network already exists.

205. By Gavin Panella

Merge trunk, resolving one conflict.

206. By Gavin Panella

Add some whitespace.

Revision history for this message
Gavin Panella (allenap) wrote :

> [0]
>
> 76      +    for _, existingSite := range *networkConfig.VirtualNetworkSites {
> 77      +        if existingSite.Name == site.Name {
> 78      +            // Network already defined.
> 79      +            return nil
> 80      +        }
>
> That's a weird behavior don't you think?  Say I try adding a network with the
> same name but a different affinity group; the method will return with a nil
> error so I'll think that everything is ok and it will be a lie :).  I /think/
> returning an error (maybe only if the network you're trying to add has exactly
> the same characteristics as the one with the same name which already exists)
> is more appropriate here.  What do you think?

Good point. I've changed it to return an error when there's a
preexisting network with the same name.

>
> [1]
>
> 102     +    for _, existingSite := range *networkConfig.VirtualNetworkSites {
> 103     +        if existingSite.Name != siteName {
> 104     +            virtualNetworkSites = append(virtualNetworkSites,
> existingSite)
> 105     +        }
>
> We cannot just remove the network in question from
> networkConfig.VirtualNetworkSites can we :/

Is there a reason why we can't?

Ah, do you mean why can't we delete the entry directly from the slice?
Because Go.

Seriously, if you know how to do this nicely, please let me know.

>
> [2]
>
> 208     +    virtualNetwork := &VirtualNetworkSite{Name:
> MakeRandomVirtualNetworkName("test-")}
> 209     +    err := api.AddVirtualNetworkSite(virtualNetwork)
> 210     +    c.Assert(err, IsNil)
> 211     +    c.Check(record, HasLen, 2)
>
> It's a detail but that's something Jeroen and I have tried to do in tests,
> especially when the tests are long: put a empty line between the
> initialization code and the method you're testing, and another after that.
> This way, we have 3 visually well-separated blocks: initialization, method
> call, checks.

It's a pretty inconsistently followed pattern, but what the hell;
fixed.

Fwiw, I've been avoiding blank lines because gof*t only adds a single
line between functions instead of the two I'm used to.

>
> [3]
>
> You could add a check in example/management/run.go to make sure that the
> created machine effectively has an IP in the virtual network.

I'll give this a go.

Revision history for this message
Gavin Panella (allenap) wrote :

> > [3]
> >
> > You could add a check in example/management/run.go to make sure that the
> > created machine effectively has an IP in the virtual network.
>
> I'll give this a go.

I've just realised there's a good reason why it doesn't do this: VMs
are not yet deployed into the virtual network that's created. That's
something for a subsequent branch.

Revision history for this message
Raphaël Badin (rvb) wrote :

> > > [3]
> > >
> > > You could add a check in example/management/run.go to make sure that the
> > > created machine effectively has an IP in the virtual network.
> >
> > I'll give this a go.
>
> I've just realised there's a good reason why it doesn't do this: VMs
> are not yet deployed into the virtual network that's created. That's
> something for a subsequent branch.

Fair enough… it should be as simple as giving the name of the vnet to gwacl.NewDeploymentForCreateVMDeployment()… and maybe adding the objects with the right affinity group in a couple of places.

Revision history for this message
Raphaël Badin (rvb) wrote :

> > Ah, do you mean why can't we delete the entry directly from the slice?
> Because Go.

Yeah, because Go :/

> Seriously, if you know how to do this nicely, please let me know.

I don't… that's a shame.

Revision history for this message
Raphaël Badin (rvb) wrote :

Thanks for the fixes.

review: Approve
Revision history for this message
Gavin Panella (allenap) wrote :

Thanks for the review!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'example/management/run.go'
2--- example/management/run.go 2013-07-10 16:59:00 +0000
3+++ example/management/run.go 2013-07-12 13:07:30 +0000
4@@ -108,33 +108,21 @@
5
6 virtualNetworkName := gwacl.MakeRandomVirtualNetworkName("virtual-net-")
7 fmt.Printf("Creating virtual network %s...\n", virtualNetworkName)
8- // FIXME: This clobbers *all* networking configuration instead of just
9- // adding the specific virtual network.
10- vnetRequest := &gwacl.NetworkConfiguration{
11- XMLNS: gwacl.XMLNS_NC,
12- VirtualNetworkSites: &[]gwacl.VirtualNetworkSite{
13- {
14- Name: virtualNetworkName,
15- AffinityGroup: affinityGroupName,
16- AddressSpacePrefixes: []string{
17- "10.0.0.0/8",
18- },
19- },
20+ virtualNetwork := gwacl.VirtualNetworkSite{
21+ Name: virtualNetworkName,
22+ AffinityGroup: affinityGroupName,
23+ AddressSpacePrefixes: []string{
24+ "10.0.0.0/8",
25 },
26 }
27- err = api.SetNetworkConfiguration(vnetRequest)
28+ err = api.AddVirtualNetworkSite(&virtualNetwork)
29 checkError(err)
30 fmt.Println("Done creating virtual network")
31
32 defer func() {
33- fmt.Println("Deleting virtual network...")
34- // FIXME: This destroys *all* networking configuration instead of just
35- // removing the specific network we created.
36- api.SetNetworkConfiguration(&gwacl.NetworkConfiguration{
37- XMLNS: gwacl.XMLNS_NC,
38- VirtualNetworkSites: &[]gwacl.VirtualNetworkSite{},
39- })
40- fmt.Println("Done deleting virtual network")
41+ fmt.Printf("Deleting virtual network %s...\n", virtualNetworkName)
42+ api.RemoveVirtualNetworkSite(virtualNetworkName)
43+ fmt.Printf("Done deleting virtual network %s\n", virtualNetworkName)
44 }()
45
46 networkConfig, err := api.GetNetworkConfiguration()
47
48=== modified file 'management.go'
49--- management.go 2013-07-08 07:11:29 +0000
50+++ management.go 2013-07-12 13:07:30 +0000
51@@ -4,6 +4,7 @@
52 package gwacl
53
54 import (
55+ "fmt"
56 "sort"
57 "strings"
58 )
59@@ -199,3 +200,55 @@
60 // Done.
61 return nil
62 }
63+
64+func (api *ManagementAPI) AddVirtualNetworkSite(site *VirtualNetworkSite) error {
65+ // Obtain the current network config, which we will then modify.
66+ networkConfig, err := api.GetNetworkConfiguration()
67+ if err != nil {
68+ return err
69+ }
70+ if networkConfig == nil {
71+ // There's no config yet.
72+ networkConfig = &NetworkConfiguration{XMLNS: XMLNS_NC}
73+ }
74+ if networkConfig.VirtualNetworkSites == nil {
75+ networkConfig.VirtualNetworkSites = &[]VirtualNetworkSite{}
76+ }
77+ // Check to see if this network already exists.
78+ for _, existingSite := range *networkConfig.VirtualNetworkSites {
79+ if existingSite.Name == site.Name {
80+ // Network already defined.
81+ return fmt.Errorf("could not add virtual network: %q already exists", site.Name)
82+ }
83+ }
84+ // Add the network to the configuration.
85+ virtualNetworkSites := append(*networkConfig.VirtualNetworkSites, *site)
86+ networkConfig.VirtualNetworkSites = &virtualNetworkSites
87+ // Put it back up to Azure. There's a race here...
88+ return api.SetNetworkConfiguration(networkConfig)
89+}
90+
91+func (api *ManagementAPI) RemoveVirtualNetworkSite(siteName string) error {
92+ // Obtain the current network config, which we will then modify.
93+ networkConfig, err := api.GetNetworkConfiguration()
94+ if err != nil {
95+ return err
96+ }
97+ if networkConfig == nil || networkConfig.VirtualNetworkSites == nil {
98+ // There's no config, nothing to do.
99+ return nil
100+ }
101+ // Remove all references to the specified virtual network site name.
102+ virtualNetworkSites := []VirtualNetworkSite{}
103+ for _, existingSite := range *networkConfig.VirtualNetworkSites {
104+ if existingSite.Name != siteName {
105+ virtualNetworkSites = append(virtualNetworkSites, existingSite)
106+ }
107+ }
108+ if len(virtualNetworkSites) < len(*networkConfig.VirtualNetworkSites) {
109+ // Put it back up to Azure. There's a race here...
110+ networkConfig.VirtualNetworkSites = &virtualNetworkSites
111+ return api.SetNetworkConfiguration(networkConfig)
112+ }
113+ return nil
114+}
115
116=== modified file 'management_base_test.go'
117--- management_base_test.go 2013-07-12 04:45:34 +0000
118+++ management_base_test.go 2013-07-12 13:07:30 +0000
119@@ -1001,6 +1001,15 @@
120 assertGetNetworkConfigurationRequest(c, api, recordedRequests[0])
121 }
122
123+func assertSetNetworkConfigurationRequest(c *C, api *ManagementAPI, body []byte, httpRequest *X509Request) {
124+ expectedURL := fmt.Sprintf(
125+ "%s%s/services/networking/media", AZURE_URL,
126+ api.session.subscriptionId)
127+ checkRequest(c, httpRequest, expectedURL, "2012-03-01", body, "PUT")
128+ // Azure chokes when the content type is text/xml or similar.
129+ c.Assert(httpRequest.ContentType, Equals, "application/octet-stream")
130+}
131+
132 func (suite *managementBaseAPISuite) TestSetNetworkConfiguration(c *C) {
133 api := makeAPI(c)
134 fixedResponse := x509Response{StatusCode: http.StatusOK}
135@@ -1015,6 +1024,6 @@
136 err = api.SetNetworkConfiguration(request)
137
138 c.Assert(err, IsNil)
139- expectedURL := AZURE_URL + api.session.subscriptionId + "/services/networking/media"
140- checkOneRequest(c, &recordedRequests, expectedURL, "2012-03-01", requestPayload, "PUT")
141+ c.Assert(recordedRequests, HasLen, 1)
142+ assertSetNetworkConfigurationRequest(c, api, requestPayload, recordedRequests[0])
143 }
144
145=== modified file 'management_test.go'
146--- management_test.go 2013-07-12 04:22:16 +0000
147+++ management_test.go 2013-07-12 13:07:30 +0000
148@@ -579,3 +579,267 @@
149 c.Check(err, ErrorMatches, "DELETE request failed [(]500: Internal Server Error[)]")
150 c.Check(record, HasLen, 4)
151 }
152+
153+type suiteAddVirtualNetworkSite struct{}
154+
155+var _ = Suite(&suiteAddVirtualNetworkSite{})
156+
157+func (suite *suiteAddVirtualNetworkSite) TestWhenConfigCannotBeFetched(c *C) {
158+ responses := []DispatcherResponse{
159+ {response: &x509Response{StatusCode: http.StatusInternalServerError}},
160+ }
161+ record := []*X509Request{}
162+ rigRecordingPreparedResponseDispatcher(&record, responses)
163+ api := makeAPI(c)
164+
165+ err := api.AddVirtualNetworkSite(nil)
166+
167+ c.Assert(err, NotNil)
168+ c.Check(err, ErrorMatches, "GET request failed [(]500: Internal Server Error[)]")
169+ c.Check(record, HasLen, 1)
170+ assertGetNetworkConfigurationRequest(c, api, record[0])
171+}
172+
173+func (suite *suiteAddVirtualNetworkSite) TestWhenConfigDoesNotExist(c *C) {
174+ responses := []DispatcherResponse{
175+ // No configuration found.
176+ {response: &x509Response{StatusCode: http.StatusNotFound}},
177+ // Accept upload of new configuration.
178+ {response: &x509Response{StatusCode: http.StatusOK}},
179+ }
180+ record := []*X509Request{}
181+ rigRecordingPreparedResponseDispatcher(&record, responses)
182+ api := makeAPI(c)
183+ virtualNetwork := &VirtualNetworkSite{Name: MakeRandomVirtualNetworkName("test-")}
184+
185+ err := api.AddVirtualNetworkSite(virtualNetwork)
186+
187+ c.Assert(err, IsNil)
188+ c.Check(record, HasLen, 2)
189+ assertGetNetworkConfigurationRequest(c, api, record[0])
190+ expected := &NetworkConfiguration{
191+ XMLNS: XMLNS_NC,
192+ VirtualNetworkSites: &[]VirtualNetworkSite{*virtualNetwork},
193+ }
194+ expectedBody, err := expected.Serialize()
195+ c.Assert(err, IsNil)
196+ assertSetNetworkConfigurationRequest(c, api, []byte(expectedBody), record[1])
197+}
198+
199+func (suite *suiteAddVirtualNetworkSite) TestWhenNoPreexistingVirtualNetworkSites(c *C) {
200+ // Prepare a basic, empty, configuration.
201+ existingConfig := &NetworkConfiguration{XMLNS: XMLNS_NC}
202+ responses := makeOKXMLResponse(c, existingConfig)
203+ responses = append(responses, DispatcherResponse{
204+ // Accept upload of new configuration.
205+ response: &x509Response{StatusCode: http.StatusOK},
206+ })
207+ record := []*X509Request{}
208+ rigRecordingPreparedResponseDispatcher(&record, responses)
209+ api := makeAPI(c)
210+ virtualNetwork := &VirtualNetworkSite{Name: MakeRandomVirtualNetworkName("test-")}
211+
212+ err := api.AddVirtualNetworkSite(virtualNetwork)
213+
214+ c.Assert(err, IsNil)
215+ c.Check(record, HasLen, 2)
216+ assertGetNetworkConfigurationRequest(c, api, record[0])
217+ expected := &NetworkConfiguration{
218+ XMLNS: XMLNS_NC,
219+ VirtualNetworkSites: &[]VirtualNetworkSite{*virtualNetwork},
220+ }
221+ expectedBody, err := expected.Serialize()
222+ c.Assert(err, IsNil)
223+ assertSetNetworkConfigurationRequest(c, api, []byte(expectedBody), record[1])
224+}
225+
226+func (suite *suiteAddVirtualNetworkSite) TestWhenPreexistingVirtualNetworkSites(c *C) {
227+ // Prepare a configuration with a single virtual network.
228+ existingConfig := &NetworkConfiguration{
229+ XMLNS: XMLNS_NC,
230+ VirtualNetworkSites: &[]VirtualNetworkSite{
231+ {Name: MakeRandomVirtualNetworkName("test-")},
232+ },
233+ }
234+ responses := makeOKXMLResponse(c, existingConfig)
235+ responses = append(responses, DispatcherResponse{
236+ response: &x509Response{StatusCode: http.StatusOK},
237+ })
238+ record := []*X509Request{}
239+ rigRecordingPreparedResponseDispatcher(&record, responses)
240+ api := makeAPI(c)
241+ virtualNetwork := &VirtualNetworkSite{Name: MakeRandomVirtualNetworkName("test-")}
242+
243+ err := api.AddVirtualNetworkSite(virtualNetwork)
244+
245+ c.Assert(err, IsNil)
246+ c.Check(record, HasLen, 2)
247+ assertGetNetworkConfigurationRequest(c, api, record[0])
248+ expectedSites := append(
249+ *existingConfig.VirtualNetworkSites, *virtualNetwork)
250+ expected := &NetworkConfiguration{
251+ XMLNS: XMLNS_NC,
252+ VirtualNetworkSites: &expectedSites,
253+ }
254+ expectedBody, err := expected.Serialize()
255+ c.Assert(err, IsNil)
256+ assertSetNetworkConfigurationRequest(c, api, []byte(expectedBody), record[1])
257+}
258+
259+func (suite *suiteAddVirtualNetworkSite) TestWhenPreexistingVirtualNetworkSiteWithSameName(c *C) {
260+ // Prepare a configuration with a single virtual network.
261+ existingConfig := &NetworkConfiguration{
262+ XMLNS: XMLNS_NC,
263+ VirtualNetworkSites: &[]VirtualNetworkSite{
264+ {Name: "virtual-network-bob"},
265+ },
266+ }
267+ responses := makeOKXMLResponse(c, existingConfig)
268+ rigPreparedResponseDispatcher(responses)
269+ api := makeAPI(c)
270+ virtualNetwork := &VirtualNetworkSite{Name: "virtual-network-bob"}
271+
272+ err := api.AddVirtualNetworkSite(virtualNetwork)
273+
274+ c.Check(err, ErrorMatches, "could not add virtual network: \"virtual-network-bob\" already exists")
275+}
276+
277+func (suite *suiteAddVirtualNetworkSite) TestWhenConfigCannotBePushed(c *C) {
278+ responses := []DispatcherResponse{
279+ // No configuration found.
280+ {response: &x509Response{StatusCode: http.StatusNotFound}},
281+ // Cannot accept upload of new configuration.
282+ {response: &x509Response{StatusCode: http.StatusInternalServerError}},
283+ }
284+ rigPreparedResponseDispatcher(responses)
285+ virtualNetwork := &VirtualNetworkSite{Name: MakeRandomVirtualNetworkName("test-")}
286+
287+ err := makeAPI(c).AddVirtualNetworkSite(virtualNetwork)
288+
289+ c.Assert(err, NotNil)
290+ c.Check(err, ErrorMatches, "PUT request failed [(]500: Internal Server Error[)]")
291+}
292+
293+type suiteRemoveVirtualNetworkSite struct{}
294+
295+var _ = Suite(&suiteRemoveVirtualNetworkSite{})
296+
297+func (suite *suiteRemoveVirtualNetworkSite) TestWhenConfigCannotBeFetched(c *C) {
298+ responses := []DispatcherResponse{
299+ {response: &x509Response{StatusCode: http.StatusInternalServerError}},
300+ }
301+ record := []*X509Request{}
302+ rigRecordingPreparedResponseDispatcher(&record, responses)
303+ api := makeAPI(c)
304+
305+ err := api.RemoveVirtualNetworkSite("virtual-network-o-doom")
306+
307+ c.Check(err, ErrorMatches, "GET request failed [(]500: Internal Server Error[)]")
308+ c.Check(record, HasLen, 1)
309+ assertGetNetworkConfigurationRequest(c, api, record[0])
310+}
311+
312+func (suite *suiteRemoveVirtualNetworkSite) TestWhenConfigDoesNotExist(c *C) {
313+ responses := []DispatcherResponse{
314+ {response: &x509Response{StatusCode: http.StatusNotFound}},
315+ }
316+ record := []*X509Request{}
317+ rigRecordingPreparedResponseDispatcher(&record, responses)
318+ api := makeAPI(c)
319+
320+ err := api.RemoveVirtualNetworkSite("virtual-network-in-my-eyes")
321+
322+ c.Assert(err, IsNil)
323+ c.Check(record, HasLen, 1)
324+ assertGetNetworkConfigurationRequest(c, api, record[0])
325+}
326+
327+func (suite *suiteRemoveVirtualNetworkSite) TestWhenNoPreexistingVirtualNetworkSites(c *C) {
328+ // Prepare a basic, empty, configuration.
329+ existingConfig := &NetworkConfiguration{XMLNS: XMLNS_NC}
330+ responses := makeOKXMLResponse(c, existingConfig)
331+ record := []*X509Request{}
332+ rigRecordingPreparedResponseDispatcher(&record, responses)
333+ api := makeAPI(c)
334+
335+ err := api.RemoveVirtualNetworkSite("virtual-network-on-my-shoes")
336+
337+ c.Assert(err, IsNil)
338+ c.Check(record, HasLen, 1)
339+ assertGetNetworkConfigurationRequest(c, api, record[0])
340+}
341+
342+func (suite *suiteRemoveVirtualNetworkSite) TestWhenPreexistingVirtualNetworkSites(c *C) {
343+ // Prepare a configuration with a single virtual network.
344+ existingConfig := &NetworkConfiguration{
345+ XMLNS: XMLNS_NC,
346+ VirtualNetworkSites: &[]VirtualNetworkSite{
347+ {Name: MakeRandomVirtualNetworkName("test-")},
348+ },
349+ }
350+ responses := makeOKXMLResponse(c, existingConfig)
351+ responses = append(responses, DispatcherResponse{
352+ response: &x509Response{StatusCode: http.StatusOK},
353+ })
354+ record := []*X509Request{}
355+ rigRecordingPreparedResponseDispatcher(&record, responses)
356+ api := makeAPI(c)
357+ virtualNetwork := &VirtualNetworkSite{Name: MakeRandomVirtualNetworkName("test-")}
358+
359+ err := api.RemoveVirtualNetworkSite(virtualNetwork.Name)
360+
361+ c.Assert(err, IsNil)
362+ c.Check(record, HasLen, 1)
363+ assertGetNetworkConfigurationRequest(c, api, record[0])
364+ // It didn't do anything, so no upload.
365+}
366+
367+func (suite *suiteRemoveVirtualNetworkSite) TestWhenPreexistingVirtualNetworkSiteWithSameName(c *C) {
368+ // Prepare a configuration with a single virtual network.
369+ existingConfig := &NetworkConfiguration{
370+ XMLNS: XMLNS_NC,
371+ VirtualNetworkSites: &[]VirtualNetworkSite{
372+ {Name: "virtual-network-bob"},
373+ },
374+ }
375+ responses := makeOKXMLResponse(c, existingConfig)
376+ responses = append(responses, DispatcherResponse{
377+ response: &x509Response{StatusCode: http.StatusOK},
378+ })
379+ record := []*X509Request{}
380+ rigRecordingPreparedResponseDispatcher(&record, responses)
381+ api := makeAPI(c)
382+ virtualNetwork := &VirtualNetworkSite{Name: "virtual-network-bob"}
383+
384+ err := api.RemoveVirtualNetworkSite(virtualNetwork.Name)
385+
386+ c.Assert(err, IsNil)
387+ c.Check(record, HasLen, 2)
388+ assertGetNetworkConfigurationRequest(c, api, record[0])
389+ expected := &NetworkConfiguration{
390+ XMLNS: XMLNS_NC,
391+ VirtualNetworkSites: &[]VirtualNetworkSite{},
392+ }
393+ expectedBody, err := expected.Serialize()
394+ c.Assert(err, IsNil)
395+ assertSetNetworkConfigurationRequest(c, api, []byte(expectedBody), record[1])
396+}
397+
398+func (suite *suiteRemoveVirtualNetworkSite) TestWhenConfigCannotBePushed(c *C) {
399+ existingConfig := &NetworkConfiguration{
400+ XMLNS: XMLNS_NC,
401+ VirtualNetworkSites: &[]VirtualNetworkSite{
402+ {Name: "virtual-network-all-over"},
403+ },
404+ }
405+ responses := makeOKXMLResponse(c, existingConfig)
406+ responses = append(responses, DispatcherResponse{
407+ response: &x509Response{StatusCode: http.StatusInternalServerError},
408+ })
409+ rigPreparedResponseDispatcher(responses)
410+
411+ err := makeAPI(c).RemoveVirtualNetworkSite("virtual-network-all-over")
412+
413+ c.Assert(err, NotNil)
414+ c.Check(err, ErrorMatches, "PUT request failed [(]500: Internal Server Error[)]")
415+}
416
417=== modified file 'xmlobjects.go'
418--- xmlobjects.go 2013-07-11 03:41:33 +0000
419+++ xmlobjects.go 2013-07-12 13:07:30 +0000
420@@ -626,7 +626,6 @@
421 }
422
423 type VirtualNetworkSite struct {
424- XMLName string `xml:"VirtualNetworkSite"`
425 Name string `xml:"name,attr"`
426 AffinityGroup string `xml:"AffinityGroup,attr"`
427 AddressSpacePrefixes []string `xml:"AddressSpace>AddressPrefix"`

Subscribers

People subscribed via source and target branches

to all changes: