Merge lp:~jtv/gwacl/fix-upgrade-breakage into lp:gwacl

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: 188
Merged at revision: 187
Proposed branch: lp:~jtv/gwacl/fix-upgrade-breakage
Merge into: lp:gwacl
Diff against target: 230 lines (+28/-23)
4 files modified
management_base_test.go (+4/-1)
storage_base_test.go (+1/-1)
storage_test.go (+3/-2)
xmlobjects_test.go (+20/-19)
To merge this branch: bzr merge lp:~jtv/gwacl/fix-upgrade-breakage
Reviewer Review Type Date Requested Status
Gavin Panella Approve
Review via email: mp+175232@code.launchpad.net

Commit message

Fix the test failures (but not the horrible crashes) that happen when upgrading from go1.0.2 to go1.1.1.

Description of the change

There are also a bunch of segfaults that Julian is currently looking into. But the actual "failures" were caused by XML serialization no longer including a leading newline.

This fix is tedious and repetitive (really, it should quite literally be the exact same fix for all cases) but it has the advantage that it works on both Go versions, and will continue to work with other similar whitespace changes.

Jeroen

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'management_base_test.go'
--- management_base_test.go 2013-07-17 01:11:29 +0000
+++ management_base_test.go 2013-07-17 09:19:40 +0000
@@ -256,7 +256,10 @@
256256
257func checkRequest(c *C, request *X509Request, URL, version string, payload []byte, Method string) {257func checkRequest(c *C, request *X509Request, URL, version string, payload []byte, Method string) {
258 c.Check(request.URL, Equals, URL)258 c.Check(request.URL, Equals, URL)
259 c.Check(string(request.Payload), Equals, string(payload))259 c.Check(
260 strings.TrimSpace(string(request.Payload)),
261 Equals,
262 strings.TrimSpace(string(payload)))
260 c.Check(request.Method, Equals, Method)263 c.Check(request.Method, Equals, Method)
261 c.Check(request.APIVersion, Equals, version)264 c.Check(request.APIVersion, Equals, version)
262}265}
263266
=== modified file 'storage_base_test.go'
--- storage_base_test.go 2013-07-02 04:18:26 +0000
+++ storage_base_test.go 2013-07-17 09:19:40 +0000
@@ -919,7 +919,7 @@
919 <Latest>YjE=</Latest>919 <Latest>YjE=</Latest>
920 <Latest>YjI=</Latest>920 <Latest>YjI=</Latest>
921 </BlockList>`)921 </BlockList>`)
922 c.Check(string(data), Equals, expected)922 c.Check(strings.TrimSpace(string(data)), Equals, strings.TrimSpace(expected))
923}923}
924924
925// Client-side errors from the HTTP client are propagated back to the caller.925// Client-side errors from the HTTP client are propagated back to the caller.
926926
=== modified file 'storage_test.go'
--- storage_test.go 2013-07-02 14:21:28 +0000
+++ storage_test.go 2013-07-17 09:19:40 +0000
@@ -11,6 +11,7 @@
11 . "launchpad.net/gocheck"11 . "launchpad.net/gocheck"
12 "net/http"12 "net/http"
13 "net/url"13 "net/url"
14 "strings"
14)15)
1516
16type testUploadBlockBlob struct{}17type testUploadBlockBlob struct{}
@@ -90,12 +91,12 @@
90 "?comp=blocklist", context.Account))91 "?comp=blocklist", context.Account))
91 body, err := ioutil.ReadAll(exchange.Request.Body)92 body, err := ioutil.ReadAll(exchange.Request.Body)
92 c.Check(err, IsNil)93 c.Check(err, IsNil)
93 expected := "\n<BlockList>\n"94 expected := "<BlockList>\n"
94 for _, blockID := range blockIDs {95 for _, blockID := range blockIDs {
95 expected += " <Latest>" + blockID + "</Latest>\n"96 expected += " <Latest>" + blockID + "</Latest>\n"
96 }97 }
97 expected += "</BlockList>"98 expected += "</BlockList>"
98 c.Check(string(body), Equals, expected)99 c.Check(strings.TrimSpace(string(body)), Equals, strings.TrimSpace(expected))
99}100}
100101
101type testListAllBlobs struct{}102type testListAllBlobs struct{}
102103
=== modified file 'xmlobjects_test.go'
--- xmlobjects_test.go 2013-07-16 16:49:18 +0000
+++ xmlobjects_test.go 2013-07-17 09:19:40 +0000
@@ -10,6 +10,7 @@
10 . "launchpad.net/gocheck"10 . "launchpad.net/gocheck"
11 "launchpad.net/gwacl/dedent"11 "launchpad.net/gwacl/dedent"
12 "sort"12 "sort"
13 "strings"
13)14)
1415
15type xmlSuite struct{}16type xmlSuite struct{}
@@ -37,7 +38,7 @@
37 expected := fmt.Sprintf(template, config.Hostname, config.Username,38 expected := fmt.Sprintf(template, config.Hostname, config.Username,
38 config.Password, config.UserData,39 config.Password, config.UserData,
39 config.DisableSSHPasswordAuthentication)40 config.DisableSSHPasswordAuthentication)
40 c.Check(xml, Equals, expected)41 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
41}42}
4243
43func (suite *xmlSuite) TestInputEndpoint(c *C) {44func (suite *xmlSuite) TestInputEndpoint(c *C) {
@@ -63,7 +64,7 @@
63 endpoint.LocalPort, endpoint.Name, endpoint.Port,64 endpoint.LocalPort, endpoint.Name, endpoint.Port,
64 endpoint.LoadBalancerProbe.Path, endpoint.LoadBalancerProbe.Port,65 endpoint.LoadBalancerProbe.Path, endpoint.LoadBalancerProbe.Port,
65 endpoint.LoadBalancerProbe.Protocol, endpoint.Protocol, endpoint.VIP)66 endpoint.LoadBalancerProbe.Protocol, endpoint.Protocol, endpoint.VIP)
66 c.Check(xml, Equals, expected)67 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
67}68}
6869
69func (suite *xmlSuite) TestOSVirtualHardDisk(c *C) {70func (suite *xmlSuite) TestOSVirtualHardDisk(c *C) {
@@ -81,7 +82,7 @@
81 </OSVirtualHardDisk>`)82 </OSVirtualHardDisk>`)
82 expected := fmt.Sprintf(template, disk.HostCaching, disk.DiskLabel,83 expected := fmt.Sprintf(template, disk.HostCaching, disk.DiskLabel,
83 disk.DiskName, disk.MediaLink, disk.SourceImageName)84 disk.DiskName, disk.MediaLink, disk.SourceImageName)
84 c.Check(xml, Equals, expected)85 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
85}86}
8687
87func (suite *xmlSuite) TestConfigurationSetNetworkConfiguration(c *C) {88func (suite *xmlSuite) TestConfigurationSetNetworkConfiguration(c *C) {
@@ -141,7 +142,7 @@
141 endpoint2.LoadBalancerProbe.Protocol, endpoint2.Protocol,142 endpoint2.LoadBalancerProbe.Protocol, endpoint2.Protocol,
142 endpoint2.VIP,143 endpoint2.VIP,
143 subnet1, subnet2)144 subnet1, subnet2)
144 c.Check(xml, Equals, expected)145 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
145}146}
146147
147func (suite *xmlSuite) TestRole(c *C) {148func (suite *xmlSuite) TestRole(c *C) {
@@ -170,7 +171,7 @@
170 config.ConfigurationSetType, config.Hostname, config.Username,171 config.ConfigurationSetType, config.Hostname, config.Username,
171 config.Password, config.UserData,172 config.Password, config.UserData,
172 config.DisableSSHPasswordAuthentication, role.RoleSize)173 config.DisableSSHPasswordAuthentication, role.RoleSize)
173 c.Check(xml, Equals, expected)174 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
174}175}
175176
176func makePersistentVMRole(rolename string) string {177func makePersistentVMRole(rolename string) string {
@@ -374,7 +375,7 @@
374 observed, err := role.Serialize()375 observed, err := role.Serialize()
375376
376 c.Assert(err, IsNil)377 c.Assert(err, IsNil)
377 c.Assert(observed, DeepEquals, expected)378 c.Assert(strings.TrimSpace(observed), DeepEquals, strings.TrimSpace(expected))
378}379}
379380
380func (suite *xmlSuite) TestNetworkConfigurationSerialize(c *C) {381func (suite *xmlSuite) TestNetworkConfigurationSerialize(c *C) {
@@ -477,17 +478,17 @@
477478
478 observed, err := input.Serialize()479 observed, err := input.Serialize()
479 c.Assert(err, IsNil)480 c.Assert(err, IsNil)
480 c.Assert(observed, Equals, expected)481 c.Assert(strings.TrimSpace(observed), Equals, strings.TrimSpace(expected))
481}482}
482483
483func (suite *xmlSuite) TestNetworkConfigurationSerializeMinimal(c *C) {484func (suite *xmlSuite) TestNetworkConfigurationSerializeMinimal(c *C) {
484 expected := fmt.Sprintf(485 expected := fmt.Sprintf(
485 "\n<NetworkConfiguration xmlns=\"%s\"></NetworkConfiguration>",486 "<NetworkConfiguration xmlns=\"%s\"></NetworkConfiguration>",
486 XMLNS_NC)487 XMLNS_NC)
487 input := NetworkConfiguration{XMLNS: XMLNS_NC}488 input := NetworkConfiguration{XMLNS: XMLNS_NC}
488 observed, err := input.Serialize()489 observed, err := input.Serialize()
489 c.Assert(err, IsNil)490 c.Assert(err, IsNil)
490 c.Assert(observed, Equals, expected)491 c.Assert(strings.TrimSpace(observed), Equals, strings.TrimSpace(expected))
491}492}
492493
493func (suite *xmlSuite) TestNetworkConfigurationSerializeSimpleVirtualNetworkSite(c *C) {494func (suite *xmlSuite) TestNetworkConfigurationSerializeSimpleVirtualNetworkSite(c *C) {
@@ -517,7 +518,7 @@
517 }518 }
518 observed, err := input.Serialize()519 observed, err := input.Serialize()
519 c.Assert(err, IsNil)520 c.Assert(err, IsNil)
520 c.Assert(observed, Equals, expected)521 c.Assert(strings.TrimSpace(observed), Equals, strings.TrimSpace(expected))
521}522}
522523
523func (suite *xmlSuite) TestCreateAffinityGroup(c *C) {524func (suite *xmlSuite) TestCreateAffinityGroup(c *C) {
@@ -538,7 +539,7 @@
538539
539 observed, err := input.Serialize()540 observed, err := input.Serialize()
540 c.Assert(err, IsNil)541 c.Assert(err, IsNil)
541 c.Assert(observed, Equals, expected)542 c.Assert(strings.TrimSpace(observed), Equals, strings.TrimSpace(expected))
542}543}
543544
544func (suite *xmlSuite) TestNewCreateAffinityGroup(c *C) {545func (suite *xmlSuite) TestNewCreateAffinityGroup(c *C) {
@@ -568,7 +569,7 @@
568569
569 observed, err := input.Serialize()570 observed, err := input.Serialize()
570 c.Assert(err, IsNil)571 c.Assert(err, IsNil)
571 c.Assert(observed, Equals, expected)572 c.Assert(strings.TrimSpace(observed), Equals, strings.TrimSpace(expected))
572}573}
573574
574func (suite *xmlSuite) TestNewUpdateAffinityGroup(c *C) {575func (suite *xmlSuite) TestNewUpdateAffinityGroup(c *C) {
@@ -737,7 +738,7 @@
737 config.Username, config.Password, config.UserData,738 config.Username, config.Password, config.UserData,
738 config.DisableSSHPasswordAuthentication, role.RoleSize,739 config.DisableSSHPasswordAuthentication, role.RoleSize,
739 deployment.VirtualNetworkName, dns.Name, dns.Address)740 deployment.VirtualNetworkName, dns.Name, dns.Address)
740 c.Check(xml, Equals, expected)741 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
741}742}
742743
743// From http://msdn.microsoft.com/en-us/library/windowsazure/ee460804.aspx744// From http://msdn.microsoft.com/en-us/library/windowsazure/ee460804.aspx
@@ -1082,7 +1083,7 @@
1082 expected := fmt.Sprintf(template, s.ServiceName, s.Label, s.Description,1083 expected := fmt.Sprintf(template, s.ServiceName, s.Label, s.Description,
1083 s.Location, s.AffinityGroup, s.GeoReplicationEnabled, extProperty.Name,1084 s.Location, s.AffinityGroup, s.GeoReplicationEnabled, extProperty.Name,
1084 extProperty.Value)1085 extProperty.Value)
1085 c.Assert(xml, Equals, expected)1086 c.Assert(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
1086}1087}
10871088
1088//1089//
@@ -1750,7 +1751,7 @@
17501751
1751 observed, err := input.Serialize()1752 observed, err := input.Serialize()
1752 c.Assert(err, IsNil)1753 c.Assert(err, IsNil)
1753 c.Assert(observed, Equals, expected)1754 c.Assert(strings.TrimSpace(observed), Equals, strings.TrimSpace(expected))
1754}1755}
17551756
1756func (suite *xmlSuite) TestNewUpdateHostedService(c *C) {1757func (suite *xmlSuite) TestNewUpdateHostedService(c *C) {
@@ -1786,7 +1787,7 @@
1786 <Uncommitted>c2Vjb25kLWJhc2U2NC1lbmNvZGVkLWJsb2NrLWlk</Uncommitted>1787 <Uncommitted>c2Vjb25kLWJhc2U2NC1lbmNvZGVkLWJsb2NrLWlk</Uncommitted>
1787 <Latest>dGhpcmQtYmFzZTY0LWVuY29kZWQtYmxvY2staWQ=</Latest>1788 <Latest>dGhpcmQtYmFzZTY0LWVuY29kZWQtYmxvY2staWQ=</Latest>
1788 </BlockList>`)1789 </BlockList>`)
1789 c.Assert(string(observed), Equals, expected)1790 c.Assert(strings.TrimSpace(string(observed)), Equals, strings.TrimSpace(expected))
1790}1791}
17911792
1792func (suite *xmlSuite) TestGetBlockListDeserialize(c *C) {1793func (suite *xmlSuite) TestGetBlockListDeserialize(c *C) {
@@ -1837,21 +1838,21 @@
1837 expectedXML := makeOperationXML("StartRoleOperation")1838 expectedXML := makeOperationXML("StartRoleOperation")
1838 xml, err := marshalXML(startRoleOperation)1839 xml, err := marshalXML(startRoleOperation)
1839 c.Assert(err, IsNil)1840 c.Assert(err, IsNil)
1840 c.Check(string(xml), Equals, expectedXML)1841 c.Check(strings.TrimSpace(string(xml)), Equals, strings.TrimSpace(expectedXML))
1841}1842}
18421843
1843func (suite *managementAPISuite) TestRestartRoleOperation(c *C) {1844func (suite *managementAPISuite) TestRestartRoleOperation(c *C) {
1844 expectedXML := makeOperationXML("RestartRoleOperation")1845 expectedXML := makeOperationXML("RestartRoleOperation")
1845 xml, err := marshalXML(restartRoleOperation)1846 xml, err := marshalXML(restartRoleOperation)
1846 c.Assert(err, IsNil)1847 c.Assert(err, IsNil)
1847 c.Check(string(xml), Equals, expectedXML)1848 c.Check(strings.TrimSpace(string(xml)), Equals, strings.TrimSpace(expectedXML))
1848}1849}
18491850
1850func (suite *managementAPISuite) TestShutdownRoleOperation(c *C) {1851func (suite *managementAPISuite) TestShutdownRoleOperation(c *C) {
1851 expectedXML := makeOperationXML("ShutdownRoleOperation")1852 expectedXML := makeOperationXML("ShutdownRoleOperation")
1852 xml, err := marshalXML(shutdownRoleOperation)1853 xml, err := marshalXML(shutdownRoleOperation)
1853 c.Assert(err, IsNil)1854 c.Assert(err, IsNil)
1854 c.Check(string(xml), Equals, expectedXML)1855 c.Check(strings.TrimSpace(string(xml)), Equals, strings.TrimSpace(expectedXML))
1855}1856}
18561857
1857// TestOSImageWRTAddOSImage demonstrates the OSImage is a suitable container1858// TestOSImageWRTAddOSImage demonstrates the OSImage is a suitable container

Subscribers

People subscribed via source and target branches