Merge lp:~jtv/gwacl/poll-if-needed into lp:gwacl
Proposed by
Jeroen T. Vermeulen
Status: | Merged |
---|---|
Approved by: | Jeroen T. Vermeulen |
Approved revision: | 86 |
Merged at revision: | 84 |
Proposed branch: | lp:~jtv/gwacl/poll-if-needed |
Merge into: | lp:gwacl |
Diff against target: |
313 lines (+160/-28) 6 files modified
httperror.go (+16/-1) httperror_test.go (+28/-0) managementapi.go (+32/-19) managementapi_test.go (+77/-5) poller.go (+2/-3) xmlobjects.go (+5/-0) |
To merge this branch: | bzr merge lp:~jtv/gwacl/poll-if-needed |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Julian Edwards (community) | Approve | ||
Review via email: mp+156341@code.launchpad.net |
Commit message
Support both synchronous and asynchronous operations in blockUntilCompl
Description of the change
With this change in place, we'll be able to call blockUntilCompl
This will make us more robust with regard to changes in which operations are asynchronous, or inconsistencies between documentation and the real Azure service. All POST/PUT/DELETE requests can simply return blockUntilCompl
Jeroen
To post a comment you must log in.
Excellent change, thanks. TestBlockUntilC ompletedSucceed sOnSyncSuccess was really hard to read and understand but I don't have any constructive things to say about it, maybe this is just How It Has To Be with Go...
49 +func (suite *httpErrorSuite) TestNewAzureErr orFromOperation (c *C) {
Again I think consts are not useful (you may disagree) but use DeepEquals with a single struct check here.
91 +// blockUntilCompleted blocks if necessary. It does not return until the
92 +// requested operation is finished (whether successfully or unsuccessfully).
93 +// Pass in the response from the request that you want to block on. If the
94 +// response indicates that the request finished synchronously (or failed in
95 +// whatever way) then this will not block. However, if the response indicates
96 +// that the Azure service is handling the operation asynchronously, it will
97 +// poll until completion.
I found this hard to read/parse. Can I suggest a replacement:
// blockUntilCompleted blocks as necessary. It does not return until the
// requested operation has finished (whether successfully or unsuccessfully).
// The passed 'response' argument is checked and the following actions will
// occur:
// * response is synchronous: return immediately
// * response is a failure: return immediately
// * response is asynchronous: poll until the operation completes, then return
118 + case http.StatusOK, http.StatusCreated, http.StatusNoCo ntent:
Are you sure there's no other successful statuses? In the storage stuff we checked to see if it was 200-299. Honestly, I'm not sure which is better though!
189 + c.Check(err, NotNil)
Use Assert not Check here, there's not much point continuing if this bit fails.