Merge lp:~rvb/gomaasapi/record-action-params into lp:gomaasapi
Proposed by
Raphaël Badin
Status: | Merged |
---|---|
Approved by: | Raphaël Badin |
Approved revision: | 40 |
Merged at revision: | 39 |
Proposed branch: | lp:~rvb/gomaasapi/record-action-params |
Merge into: | lp:gomaasapi |
Diff against target: |
137 lines (+59/-11) 2 files modified
testservice.go (+39/-8) testservice_test.go (+20/-3) |
To merge this branch: | bzr merge lp:~rvb/gomaasapi/record-action-params |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | Approve | ||
Review via email: mp+158117@code.launchpad.net |
Commit message
Make the testservice record the url.Values posted when performing an operation (e.g. starting a node).
Description of the change
I chose to add another field named "nodeOperationR
The main reason behind that change is so that we can check that the provider sends the correct "user data" when starting a node: https:/
To post a comment you must log in.
[1]
+ nodeOperationRe questValues map[string] []url.Values
This needs a comment to explain what the string is meant to denote. Or
a type alias could be used (I guess; Go's probably got some gotcha up
it's sleeve to make that awkward).
[2]
+func (server *TestServer) NodeOperationRe questValues( ) map[string] []url.Values { nodeOperationRe questValues
+ return server.
+}
Why not make the field public in the first place?
If you want to ensure that this field is read-only field, then maybe
this'll work: it'll return by value (?) and so copy the returned map
(?), but will it copy the values in the map or references? In other
words, will the values be shared?
I think I hate pass by value.
[3]
+ operationReques tValues, _ := server. nodeOperationRe questValues[ systemId]
Can you add a comment explaining why the second return value is being
ignored? I think I get it from reading the code (the `present` value
from the preceding line is sufficient) but it would be worth helping
future devs out.
[4]
+ if request.Body != nil { string( body))
...
+ requestValues, err = url.ParseQuery(
The condition here should be that there's a body *and* that the x-www-form- encoded.
Content-Type is application/
(I think the test service ought to be strict about what it accepts.)
[5]
+ nodeOperationRe questValues map[string] []url.Values
This expands to:
nodeOperationR equestValues map[string] []map[string] []string
Which, having read around a bit, reads as:
A mapping of system IDs to lists of mappings of query parameters.
Or, in Python syntax:
{"sys1": [
{"param1": ["value1", "value2"], "param2": ["value3"]},
{...}
],
"sys2": [
...
],
...
}
Is that right?