Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4093)

Issue 7388055: Add prefix support to swift test double (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by wallyworld
Modified:
11 years, 2 months ago
Reviewers:
mp+150265, jameinel, dimitern
Visibility:
Public.

Description

Add prefix support to swift test double The swift test double did not support using prefix=xxx to filter container listings. This branch adds that support which is required to make some juju-core tests pass. https://code.launchpad.net/~wallyworld/goose/swift-double-prefix-support/+merge/150265 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 14
Unified diffs Side-by-side diffs Delta from patch set Stats (+82 lines, -10 lines) Patch
A [revision details] View 1 chunk +2 lines, -0 lines 0 comments Download
M testservices/swiftservice/service.go View 3 chunks +15 lines, -5 lines 5 comments Download
M testservices/swiftservice/service_http.go View 2 chunks +12 lines, -1 line 3 comments Download
M testservices/swiftservice/service_http_test.go View 3 chunks +36 lines, -3 lines 4 comments Download
M testservices/swiftservice/service_test.go View 1 chunk +17 lines, -1 line 2 comments Download

Messages

Total messages: 4
wallyworld
Please take a look.
11 years, 2 months ago (2013-02-25 06:35:51 UTC) #1
dimitern
LGTM, just a few trivials. https://codereview.appspot.com/7388055/diff/1/testservices/swiftservice/service.go File testservices/swiftservice/service.go (right): https://codereview.appspot.com/7388055/diff/1/testservices/swiftservice/service.go#newcode102 testservices/swiftservice/service.go:102: // ListContainer lists the ...
11 years, 2 months ago (2013-02-25 07:16:22 UTC) #2
jameinel
LGTM https://codereview.appspot.com/7388055/diff/1/testservices/swiftservice/service.go File testservices/swiftservice/service.go (right): https://codereview.appspot.com/7388055/diff/1/testservices/swiftservice/service.go#newcode111 testservices/swiftservice/service.go:111: sorted := make([]string, 0, len(items)) He is pre-allocating ...
11 years, 2 months ago (2013-02-25 07:42:34 UTC) #3
wallyworld
11 years, 2 months ago (2013-02-26 01:04:21 UTC) #4
https://codereview.appspot.com/7388055/diff/1/testservices/swiftservice/servi...
File testservices/swiftservice/service.go (right):

https://codereview.appspot.com/7388055/diff/1/testservices/swiftservice/servi...
testservices/swiftservice/service.go:102: // ListContainer lists the objects in
the given container.
On 2013/02/25 07:16:22, dimitern wrote:
> Update the comment about the new params?

Done.

https://codereview.appspot.com/7388055/diff/1/testservices/swiftservice/servi...
testservices/swiftservice/service.go:111: sorted := make([]string, 0,
len(items))
On 2013/02/25 07:42:34, jameinel wrote:
> He is pre-allocating enough items in the array so it doesn't have to resize
> during the loop.
> 
> It isn't a huge deal, but IMO it is a good practice to pre-allocate when you
> know the final size.

The final size isn't know until the loop ends, and the loop is appending to the
slice in question so I took the decision to pre-allocate the known maximum size
as the capacity. The initial length is 0 as expected so I think it's a
reasonable decision to make.

https://codereview.appspot.com/7388055/diff/1/testservices/swiftservice/servi...
File testservices/swiftservice/service_http.go (right):

https://codereview.appspot.com/7388055/diff/1/testservices/swiftservice/servi...
testservices/swiftservice/service_http.go:58: contents, err :=
s.ListContainer(container, params)
On 2013/02/25 07:42:34, jameinel wrote:
> On 2013/02/25 07:16:22, dimitern wrote:
> > So it'll work without any params as well?
> 
> I'm pretty sure len(urlParams) can be done, in which case you just have an
empty
> map. Which all the code I've seen just iterates over the map, so they should
all
> be fine.

Yes, works fine without params.

https://codereview.appspot.com/7388055/diff/1/testservices/swiftservice/servi...
File testservices/swiftservice/service_test.go (right):

https://codereview.appspot.com/7388055/diff/1/testservices/swiftservice/servi...
testservices/swiftservice/service_test.go:95: containerData, err :=
s.service.ListContainer("test", map[string]string{})
On 2013/02/25 07:16:22, dimitern wrote:
> Sending nil instead of an empty map should work.

Good pickup, thanks.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b