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
=== modified file 'example/management/run.go'
--- example/management/run.go 2013-07-10 16:59:00 +0000
+++ example/management/run.go 2013-07-12 13:07:30 +0000
@@ -108,33 +108,21 @@
108108
109 virtualNetworkName := gwacl.MakeRandomVirtualNetworkName("virtual-net-")109 virtualNetworkName := gwacl.MakeRandomVirtualNetworkName("virtual-net-")
110 fmt.Printf("Creating virtual network %s...\n", virtualNetworkName)110 fmt.Printf("Creating virtual network %s...\n", virtualNetworkName)
111 // FIXME: This clobbers *all* networking configuration instead of just111 virtualNetwork := gwacl.VirtualNetworkSite{
112 // adding the specific virtual network.112 Name: virtualNetworkName,
113 vnetRequest := &gwacl.NetworkConfiguration{113 AffinityGroup: affinityGroupName,
114 XMLNS: gwacl.XMLNS_NC,114 AddressSpacePrefixes: []string{
115 VirtualNetworkSites: &[]gwacl.VirtualNetworkSite{115 "10.0.0.0/8",
116 {
117 Name: virtualNetworkName,
118 AffinityGroup: affinityGroupName,
119 AddressSpacePrefixes: []string{
120 "10.0.0.0/8",
121 },
122 },
123 },116 },
124 }117 }
125 err = api.SetNetworkConfiguration(vnetRequest)118 err = api.AddVirtualNetworkSite(&virtualNetwork)
126 checkError(err)119 checkError(err)
127 fmt.Println("Done creating virtual network")120 fmt.Println("Done creating virtual network")
128121
129 defer func() {122 defer func() {
130 fmt.Println("Deleting virtual network...")123 fmt.Printf("Deleting virtual network %s...\n", virtualNetworkName)
131 // FIXME: This destroys *all* networking configuration instead of just124 api.RemoveVirtualNetworkSite(virtualNetworkName)
132 // removing the specific network we created.125 fmt.Printf("Done deleting virtual network %s\n", virtualNetworkName)
133 api.SetNetworkConfiguration(&gwacl.NetworkConfiguration{
134 XMLNS: gwacl.XMLNS_NC,
135 VirtualNetworkSites: &[]gwacl.VirtualNetworkSite{},
136 })
137 fmt.Println("Done deleting virtual network")
138 }()126 }()
139127
140 networkConfig, err := api.GetNetworkConfiguration()128 networkConfig, err := api.GetNetworkConfiguration()
141129
=== modified file 'management.go'
--- management.go 2013-07-08 07:11:29 +0000
+++ management.go 2013-07-12 13:07:30 +0000
@@ -4,6 +4,7 @@
4package gwacl4package gwacl
55
6import (6import (
7 "fmt"
7 "sort"8 "sort"
8 "strings"9 "strings"
9)10)
@@ -199,3 +200,55 @@
199 // Done.200 // Done.
200 return nil201 return nil
201}202}
203
204func (api *ManagementAPI) AddVirtualNetworkSite(site *VirtualNetworkSite) error {
205 // Obtain the current network config, which we will then modify.
206 networkConfig, err := api.GetNetworkConfiguration()
207 if err != nil {
208 return err
209 }
210 if networkConfig == nil {
211 // There's no config yet.
212 networkConfig = &NetworkConfiguration{XMLNS: XMLNS_NC}
213 }
214 if networkConfig.VirtualNetworkSites == nil {
215 networkConfig.VirtualNetworkSites = &[]VirtualNetworkSite{}
216 }
217 // Check to see if this network already exists.
218 for _, existingSite := range *networkConfig.VirtualNetworkSites {
219 if existingSite.Name == site.Name {
220 // Network already defined.
221 return fmt.Errorf("could not add virtual network: %q already exists", site.Name)
222 }
223 }
224 // Add the network to the configuration.
225 virtualNetworkSites := append(*networkConfig.VirtualNetworkSites, *site)
226 networkConfig.VirtualNetworkSites = &virtualNetworkSites
227 // Put it back up to Azure. There's a race here...
228 return api.SetNetworkConfiguration(networkConfig)
229}
230
231func (api *ManagementAPI) RemoveVirtualNetworkSite(siteName string) error {
232 // Obtain the current network config, which we will then modify.
233 networkConfig, err := api.GetNetworkConfiguration()
234 if err != nil {
235 return err
236 }
237 if networkConfig == nil || networkConfig.VirtualNetworkSites == nil {
238 // There's no config, nothing to do.
239 return nil
240 }
241 // Remove all references to the specified virtual network site name.
242 virtualNetworkSites := []VirtualNetworkSite{}
243 for _, existingSite := range *networkConfig.VirtualNetworkSites {
244 if existingSite.Name != siteName {
245 virtualNetworkSites = append(virtualNetworkSites, existingSite)
246 }
247 }
248 if len(virtualNetworkSites) < len(*networkConfig.VirtualNetworkSites) {
249 // Put it back up to Azure. There's a race here...
250 networkConfig.VirtualNetworkSites = &virtualNetworkSites
251 return api.SetNetworkConfiguration(networkConfig)
252 }
253 return nil
254}
202255
=== modified file 'management_base_test.go'
--- management_base_test.go 2013-07-12 04:45:34 +0000
+++ management_base_test.go 2013-07-12 13:07:30 +0000
@@ -1001,6 +1001,15 @@
1001 assertGetNetworkConfigurationRequest(c, api, recordedRequests[0])1001 assertGetNetworkConfigurationRequest(c, api, recordedRequests[0])
1002}1002}
10031003
1004func assertSetNetworkConfigurationRequest(c *C, api *ManagementAPI, body []byte, httpRequest *X509Request) {
1005 expectedURL := fmt.Sprintf(
1006 "%s%s/services/networking/media", AZURE_URL,
1007 api.session.subscriptionId)
1008 checkRequest(c, httpRequest, expectedURL, "2012-03-01", body, "PUT")
1009 // Azure chokes when the content type is text/xml or similar.
1010 c.Assert(httpRequest.ContentType, Equals, "application/octet-stream")
1011}
1012
1004func (suite *managementBaseAPISuite) TestSetNetworkConfiguration(c *C) {1013func (suite *managementBaseAPISuite) TestSetNetworkConfiguration(c *C) {
1005 api := makeAPI(c)1014 api := makeAPI(c)
1006 fixedResponse := x509Response{StatusCode: http.StatusOK}1015 fixedResponse := x509Response{StatusCode: http.StatusOK}
@@ -1015,6 +1024,6 @@
1015 err = api.SetNetworkConfiguration(request)1024 err = api.SetNetworkConfiguration(request)
10161025
1017 c.Assert(err, IsNil)1026 c.Assert(err, IsNil)
1018 expectedURL := AZURE_URL + api.session.subscriptionId + "/services/networking/media"1027 c.Assert(recordedRequests, HasLen, 1)
1019 checkOneRequest(c, &recordedRequests, expectedURL, "2012-03-01", requestPayload, "PUT")1028 assertSetNetworkConfigurationRequest(c, api, requestPayload, recordedRequests[0])
1020}1029}
10211030
=== modified file 'management_test.go'
--- management_test.go 2013-07-12 04:22:16 +0000
+++ management_test.go 2013-07-12 13:07:30 +0000
@@ -579,3 +579,267 @@
579 c.Check(err, ErrorMatches, "DELETE request failed [(]500: Internal Server Error[)]")579 c.Check(err, ErrorMatches, "DELETE request failed [(]500: Internal Server Error[)]")
580 c.Check(record, HasLen, 4)580 c.Check(record, HasLen, 4)
581}581}
582
583type suiteAddVirtualNetworkSite struct{}
584
585var _ = Suite(&suiteAddVirtualNetworkSite{})
586
587func (suite *suiteAddVirtualNetworkSite) TestWhenConfigCannotBeFetched(c *C) {
588 responses := []DispatcherResponse{
589 {response: &x509Response{StatusCode: http.StatusInternalServerError}},
590 }
591 record := []*X509Request{}
592 rigRecordingPreparedResponseDispatcher(&record, responses)
593 api := makeAPI(c)
594
595 err := api.AddVirtualNetworkSite(nil)
596
597 c.Assert(err, NotNil)
598 c.Check(err, ErrorMatches, "GET request failed [(]500: Internal Server Error[)]")
599 c.Check(record, HasLen, 1)
600 assertGetNetworkConfigurationRequest(c, api, record[0])
601}
602
603func (suite *suiteAddVirtualNetworkSite) TestWhenConfigDoesNotExist(c *C) {
604 responses := []DispatcherResponse{
605 // No configuration found.
606 {response: &x509Response{StatusCode: http.StatusNotFound}},
607 // Accept upload of new configuration.
608 {response: &x509Response{StatusCode: http.StatusOK}},
609 }
610 record := []*X509Request{}
611 rigRecordingPreparedResponseDispatcher(&record, responses)
612 api := makeAPI(c)
613 virtualNetwork := &VirtualNetworkSite{Name: MakeRandomVirtualNetworkName("test-")}
614
615 err := api.AddVirtualNetworkSite(virtualNetwork)
616
617 c.Assert(err, IsNil)
618 c.Check(record, HasLen, 2)
619 assertGetNetworkConfigurationRequest(c, api, record[0])
620 expected := &NetworkConfiguration{
621 XMLNS: XMLNS_NC,
622 VirtualNetworkSites: &[]VirtualNetworkSite{*virtualNetwork},
623 }
624 expectedBody, err := expected.Serialize()
625 c.Assert(err, IsNil)
626 assertSetNetworkConfigurationRequest(c, api, []byte(expectedBody), record[1])
627}
628
629func (suite *suiteAddVirtualNetworkSite) TestWhenNoPreexistingVirtualNetworkSites(c *C) {
630 // Prepare a basic, empty, configuration.
631 existingConfig := &NetworkConfiguration{XMLNS: XMLNS_NC}
632 responses := makeOKXMLResponse(c, existingConfig)
633 responses = append(responses, DispatcherResponse{
634 // Accept upload of new configuration.
635 response: &x509Response{StatusCode: http.StatusOK},
636 })
637 record := []*X509Request{}
638 rigRecordingPreparedResponseDispatcher(&record, responses)
639 api := makeAPI(c)
640 virtualNetwork := &VirtualNetworkSite{Name: MakeRandomVirtualNetworkName("test-")}
641
642 err := api.AddVirtualNetworkSite(virtualNetwork)
643
644 c.Assert(err, IsNil)
645 c.Check(record, HasLen, 2)
646 assertGetNetworkConfigurationRequest(c, api, record[0])
647 expected := &NetworkConfiguration{
648 XMLNS: XMLNS_NC,
649 VirtualNetworkSites: &[]VirtualNetworkSite{*virtualNetwork},
650 }
651 expectedBody, err := expected.Serialize()
652 c.Assert(err, IsNil)
653 assertSetNetworkConfigurationRequest(c, api, []byte(expectedBody), record[1])
654}
655
656func (suite *suiteAddVirtualNetworkSite) TestWhenPreexistingVirtualNetworkSites(c *C) {
657 // Prepare a configuration with a single virtual network.
658 existingConfig := &NetworkConfiguration{
659 XMLNS: XMLNS_NC,
660 VirtualNetworkSites: &[]VirtualNetworkSite{
661 {Name: MakeRandomVirtualNetworkName("test-")},
662 },
663 }
664 responses := makeOKXMLResponse(c, existingConfig)
665 responses = append(responses, DispatcherResponse{
666 response: &x509Response{StatusCode: http.StatusOK},
667 })
668 record := []*X509Request{}
669 rigRecordingPreparedResponseDispatcher(&record, responses)
670 api := makeAPI(c)
671 virtualNetwork := &VirtualNetworkSite{Name: MakeRandomVirtualNetworkName("test-")}
672
673 err := api.AddVirtualNetworkSite(virtualNetwork)
674
675 c.Assert(err, IsNil)
676 c.Check(record, HasLen, 2)
677 assertGetNetworkConfigurationRequest(c, api, record[0])
678 expectedSites := append(
679 *existingConfig.VirtualNetworkSites, *virtualNetwork)
680 expected := &NetworkConfiguration{
681 XMLNS: XMLNS_NC,
682 VirtualNetworkSites: &expectedSites,
683 }
684 expectedBody, err := expected.Serialize()
685 c.Assert(err, IsNil)
686 assertSetNetworkConfigurationRequest(c, api, []byte(expectedBody), record[1])
687}
688
689func (suite *suiteAddVirtualNetworkSite) TestWhenPreexistingVirtualNetworkSiteWithSameName(c *C) {
690 // Prepare a configuration with a single virtual network.
691 existingConfig := &NetworkConfiguration{
692 XMLNS: XMLNS_NC,
693 VirtualNetworkSites: &[]VirtualNetworkSite{
694 {Name: "virtual-network-bob"},
695 },
696 }
697 responses := makeOKXMLResponse(c, existingConfig)
698 rigPreparedResponseDispatcher(responses)
699 api := makeAPI(c)
700 virtualNetwork := &VirtualNetworkSite{Name: "virtual-network-bob"}
701
702 err := api.AddVirtualNetworkSite(virtualNetwork)
703
704 c.Check(err, ErrorMatches, "could not add virtual network: \"virtual-network-bob\" already exists")
705}
706
707func (suite *suiteAddVirtualNetworkSite) TestWhenConfigCannotBePushed(c *C) {
708 responses := []DispatcherResponse{
709 // No configuration found.
710 {response: &x509Response{StatusCode: http.StatusNotFound}},
711 // Cannot accept upload of new configuration.
712 {response: &x509Response{StatusCode: http.StatusInternalServerError}},
713 }
714 rigPreparedResponseDispatcher(responses)
715 virtualNetwork := &VirtualNetworkSite{Name: MakeRandomVirtualNetworkName("test-")}
716
717 err := makeAPI(c).AddVirtualNetworkSite(virtualNetwork)
718
719 c.Assert(err, NotNil)
720 c.Check(err, ErrorMatches, "PUT request failed [(]500: Internal Server Error[)]")
721}
722
723type suiteRemoveVirtualNetworkSite struct{}
724
725var _ = Suite(&suiteRemoveVirtualNetworkSite{})
726
727func (suite *suiteRemoveVirtualNetworkSite) TestWhenConfigCannotBeFetched(c *C) {
728 responses := []DispatcherResponse{
729 {response: &x509Response{StatusCode: http.StatusInternalServerError}},
730 }
731 record := []*X509Request{}
732 rigRecordingPreparedResponseDispatcher(&record, responses)
733 api := makeAPI(c)
734
735 err := api.RemoveVirtualNetworkSite("virtual-network-o-doom")
736
737 c.Check(err, ErrorMatches, "GET request failed [(]500: Internal Server Error[)]")
738 c.Check(record, HasLen, 1)
739 assertGetNetworkConfigurationRequest(c, api, record[0])
740}
741
742func (suite *suiteRemoveVirtualNetworkSite) TestWhenConfigDoesNotExist(c *C) {
743 responses := []DispatcherResponse{
744 {response: &x509Response{StatusCode: http.StatusNotFound}},
745 }
746 record := []*X509Request{}
747 rigRecordingPreparedResponseDispatcher(&record, responses)
748 api := makeAPI(c)
749
750 err := api.RemoveVirtualNetworkSite("virtual-network-in-my-eyes")
751
752 c.Assert(err, IsNil)
753 c.Check(record, HasLen, 1)
754 assertGetNetworkConfigurationRequest(c, api, record[0])
755}
756
757func (suite *suiteRemoveVirtualNetworkSite) TestWhenNoPreexistingVirtualNetworkSites(c *C) {
758 // Prepare a basic, empty, configuration.
759 existingConfig := &NetworkConfiguration{XMLNS: XMLNS_NC}
760 responses := makeOKXMLResponse(c, existingConfig)
761 record := []*X509Request{}
762 rigRecordingPreparedResponseDispatcher(&record, responses)
763 api := makeAPI(c)
764
765 err := api.RemoveVirtualNetworkSite("virtual-network-on-my-shoes")
766
767 c.Assert(err, IsNil)
768 c.Check(record, HasLen, 1)
769 assertGetNetworkConfigurationRequest(c, api, record[0])
770}
771
772func (suite *suiteRemoveVirtualNetworkSite) TestWhenPreexistingVirtualNetworkSites(c *C) {
773 // Prepare a configuration with a single virtual network.
774 existingConfig := &NetworkConfiguration{
775 XMLNS: XMLNS_NC,
776 VirtualNetworkSites: &[]VirtualNetworkSite{
777 {Name: MakeRandomVirtualNetworkName("test-")},
778 },
779 }
780 responses := makeOKXMLResponse(c, existingConfig)
781 responses = append(responses, DispatcherResponse{
782 response: &x509Response{StatusCode: http.StatusOK},
783 })
784 record := []*X509Request{}
785 rigRecordingPreparedResponseDispatcher(&record, responses)
786 api := makeAPI(c)
787 virtualNetwork := &VirtualNetworkSite{Name: MakeRandomVirtualNetworkName("test-")}
788
789 err := api.RemoveVirtualNetworkSite(virtualNetwork.Name)
790
791 c.Assert(err, IsNil)
792 c.Check(record, HasLen, 1)
793 assertGetNetworkConfigurationRequest(c, api, record[0])
794 // It didn't do anything, so no upload.
795}
796
797func (suite *suiteRemoveVirtualNetworkSite) TestWhenPreexistingVirtualNetworkSiteWithSameName(c *C) {
798 // Prepare a configuration with a single virtual network.
799 existingConfig := &NetworkConfiguration{
800 XMLNS: XMLNS_NC,
801 VirtualNetworkSites: &[]VirtualNetworkSite{
802 {Name: "virtual-network-bob"},
803 },
804 }
805 responses := makeOKXMLResponse(c, existingConfig)
806 responses = append(responses, DispatcherResponse{
807 response: &x509Response{StatusCode: http.StatusOK},
808 })
809 record := []*X509Request{}
810 rigRecordingPreparedResponseDispatcher(&record, responses)
811 api := makeAPI(c)
812 virtualNetwork := &VirtualNetworkSite{Name: "virtual-network-bob"}
813
814 err := api.RemoveVirtualNetworkSite(virtualNetwork.Name)
815
816 c.Assert(err, IsNil)
817 c.Check(record, HasLen, 2)
818 assertGetNetworkConfigurationRequest(c, api, record[0])
819 expected := &NetworkConfiguration{
820 XMLNS: XMLNS_NC,
821 VirtualNetworkSites: &[]VirtualNetworkSite{},
822 }
823 expectedBody, err := expected.Serialize()
824 c.Assert(err, IsNil)
825 assertSetNetworkConfigurationRequest(c, api, []byte(expectedBody), record[1])
826}
827
828func (suite *suiteRemoveVirtualNetworkSite) TestWhenConfigCannotBePushed(c *C) {
829 existingConfig := &NetworkConfiguration{
830 XMLNS: XMLNS_NC,
831 VirtualNetworkSites: &[]VirtualNetworkSite{
832 {Name: "virtual-network-all-over"},
833 },
834 }
835 responses := makeOKXMLResponse(c, existingConfig)
836 responses = append(responses, DispatcherResponse{
837 response: &x509Response{StatusCode: http.StatusInternalServerError},
838 })
839 rigPreparedResponseDispatcher(responses)
840
841 err := makeAPI(c).RemoveVirtualNetworkSite("virtual-network-all-over")
842
843 c.Assert(err, NotNil)
844 c.Check(err, ErrorMatches, "PUT request failed [(]500: Internal Server Error[)]")
845}
582846
=== modified file 'xmlobjects.go'
--- xmlobjects.go 2013-07-11 03:41:33 +0000
+++ xmlobjects.go 2013-07-12 13:07:30 +0000
@@ -626,7 +626,6 @@
626}626}
627627
628type VirtualNetworkSite struct {628type VirtualNetworkSite struct {
629 XMLName string `xml:"VirtualNetworkSite"`
630 Name string `xml:"name,attr"`629 Name string `xml:"name,attr"`
631 AffinityGroup string `xml:"AffinityGroup,attr"`630 AffinityGroup string `xml:"AffinityGroup,attr"`
632 AddressSpacePrefixes []string `xml:"AddressSpace>AddressPrefix"`631 AddressSpacePrefixes []string `xml:"AddressSpace>AddressPrefix"`

Subscribers

People subscribed via source and target branches

to all changes: