Merge lp://staging/~wallyworld/goose/null-project-description into lp://staging/goose

Proposed by Ian Booth
Status: Merged
Approved by: Ian Booth
Approved revision: 97
Merged at revision: 96
Proposed branch: lp://staging/~wallyworld/goose/null-project-description
Merge into: lp://staging/goose
Diff against target: 80 lines (+16/-11)
3 files modified
identity/keystone.go (+5/-4)
nova/local_test.go (+6/-4)
testservices/identityservice/userpass.go (+5/-3)
To merge this branch: bzr merge lp://staging/~wallyworld/goose/null-project-description
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+171011@code.staging.launchpad.net

Commit message

Support null tenant description

Go 1.0.3 has a bug which means that if an encoded json string
value is null, unmarshalling fails unless the receiving field
is defined as a string pointer. This bug is fixed in Go 1.1.

This branch tweaks the tokenResponse struct so that auth can
still work under Go 1.0.3. A few driveby tests fixes were also
made since some tests we not setting up control hooks properly.

https://codereview.appspot.com/10478044/

Description of the change

Support null tenant description

Go 1.0.3 has a bug which means that if an encoded json string
value is null, unmarshalling fails unless the receiving field
is defined as a string pointer. This bug is fixed in Go 1.1.

This branch tweaks the tokenResponse struct so that auth can
still work under Go 1.0.3. A few driveby tests fixes were also
made since some tests we not setting up control hooks properly.

https://codereview.appspot.com/10478044/

To post a comment you must log in.
Revision history for this message
Ian Booth (wallyworld) wrote :
Download full text (4.3 KiB)

Reviewers: mp+171011_code.launchpad.net,

Message:
Please take a look.

Description:
Support null tenant description

Go 1.0.3 has a bug which means that if an encoded json string
value is null, unmarshalling fails unless the receiving field
is defined as a string pointer. This bug is fixed in Go 1.1.

This branch tweaks the tokenResponse struct so that auth can
still work under Go 1.0.3. A few driveby tests fixes were also
made since some tests we not setting up control hooks properly.

https://code.launchpad.net/~wallyworld/goose/null-project-description/+merge/171011

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/10478044/

Affected files:
   A [revision details]
   M identity/keystone.go
   M nova/local_test.go
   M testservices/identityservice/userpass.go

Index: [revision details]
=== 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: <email address hidden>
+New revision: <email address hidden>

Index: identity/keystone.go
=== modified file 'identity/keystone.go'
--- identity/keystone.go 2013-05-08 21:24:11 +0000
+++ identity/keystone.go 2013-06-24 04:26:54 +0000
@@ -22,10 +22,10 @@
   Expires string `json:"expires"`
   Id string `json:"id"` // Actual token string
   Tenant struct {
- Id string `json:"id"`
- Name string `json:"name"`
- Description string `json:"description"`
- Enabled bool `json:"enabled"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Description *string `json:"description"`
+ Enabled bool `json:"enabled"`
   } `json:"tenant"`
  }

Index: nova/local_test.go
=== modified file 'nova/local_test.go'
--- nova/local_test.go 2013-04-24 11:08:15 +0000
+++ nova/local_test.go 2013-06-24 04:26:54 +0000
@@ -172,8 +172,8 @@
   fips, err := novaClient.ListFloatingIPs()
   c.Assert(err, IsNil)
   c.Assert(fips, HasLen, 0)
- s.openstack.Nova.RegisterControlPoint("addFloatingIP",
s.addFloatingIPHook(s.openstack.Nova))
- defer s.openstack.Nova.RegisterControlPoint("addFloatingIP", nil)
+ cleanup := s.openstack.Nova.RegisterControlPoint("addFloatingIP",
s.addFloatingIPHook(s.openstack.Nova))
+ defer cleanup()
   s.noMoreIPs = true
   fip, err := novaClient.AllocateFloatingIP()
   c.Assert(err, ErrorMatches, "(.|\n)*Zero floating ips available.*")
@@ -203,7 +203,8 @@
  func (s *localLiveSuite) TestReauthenticate(c *C) {
   novaClient := s.setupClient(c, nil)
   up := s.openstack.Identity.(*identityservice.UserPass)
- defer up.RegisterControlPoint("authorisation", s.authHook(up))
+ cleanup := up.RegisterControlPoint("authorisation", s.authHook(up))
+ defer cleanup()

   // An invalid token is returned after the first authentication step,
resulting in the ListServers call
   // returning a 401. Subsequent authentication calls return the correct
token so the auth retry does it's job.
@@ -215,7 +216,8 @@
  func (s *localLiveSuite) TestReauthenticateFailure(c *C) {
   novaClient := s.setupClient(c, nil)
   up := s.openstack.Identity.(*id...

Read more...

Revision history for this message
John A Meinel (jameinel) wrote :
Revision history for this message
Martin Packman (gz) wrote :

LGTM. Wasn't aware this behaviour was changing in go 1.1, the
declaration as *string might want a comment to that effect so we can
tidy up later.

https://codereview.appspot.com/10478044/diff/1/testservices/identityservice/userpass.go
File testservices/identityservice/userpass.go (right):

https://codereview.appspot.com/10478044/diff/1/testservices/identityservice/userpass.go#newcode123
testservices/identityservice/userpass.go:123: "description": null
Adding this makes a test fail without the change, right?

https://codereview.appspot.com/10478044/

Revision history for this message
Ian Booth (wallyworld) wrote :

https://codereview.appspot.com/10478044/diff/1/testservices/identityservice/userpass.go
File testservices/identityservice/userpass.go (right):

https://codereview.appspot.com/10478044/diff/1/testservices/identityservice/userpass.go#newcode123
testservices/identityservice/userpass.go:123: "description": null
On 2013/06/24 11:15:10, gz wrote:
> Adding this makes a test fail without the change, right?

I'm running Go 1.1 but I confirmed the output matches what was logged in
the bug report as triggering the error.

https://codereview.appspot.com/10478044/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches