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

Issue 13055043: state/apiserver: Last batch of Uniter API calls (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 8 months ago by dimitern
Modified:
10 years, 8 months ago
Reviewers:
mp+180597, natefinch, fwereade
Visibility:
Public.

Description

state/apiserver: Last batch of Uniter API calls This implements the last (hopefully) needed calls in the uniter server-side API facade: * ProviderType (added a TODO in uniter/modes to refactor the code and use that instead of EnvironConfig, just to get the provider type); * EnterScope; * LeaveScope; * ReadSettings (working on both the local and remote unit settings, depending on args); * WriteSettings (needed to implement the client-side Settings.Write() method). Added some suggested changes from the previous CL: slight reformatting of common_test.go to save some space; renamed params.Relations to params.RelationUnits; Changed AuthEiter to take GetAuthFunc arguments and return one. In the course of writing tests for EnterScope and LeaveScope I run into some issues with how to reliably verify the unit has entered or left the scope. I tried using the same way as in relationunit_test.go - RelationScopeWatcher, but it didn't work. So I decided to add a small function to state.RelationUnit, called InScope() bool, and updated the state tests to verify it works. I use InScope() in the uniter_test.go https://code.launchpad.net/~dimitern/juju-core/106-apiserver-uniter-relationunit-ops/+merge/180597 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 19

Patch Set 2 : state/apiserver: Last batch of Uniter API calls #

Unified diffs Side-by-side diffs Delta from patch set Stats (+679 lines, -99 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M state/api/params/internal.go View 1 2 chunks +38 lines, -11 lines 0 comments Download
M state/apiserver/common/common_test.go View 1 chunk +46 lines, -55 lines 0 comments Download
M state/apiserver/common/interfaces.go View 1 chunk +1 line, -1 line 0 comments Download
M state/apiserver/uniter/uniter.go View 1 5 chunks +203 lines, -18 lines 0 comments Download
M state/apiserver/uniter/uniter_test.go View 1 5 chunks +294 lines, -14 lines 0 comments Download
M state/relationunit.go View 1 1 chunk +13 lines, -0 lines 0 comments Download
M state/relationunit_test.go View 24 chunks +78 lines, -0 lines 0 comments Download
M worker/uniter/modes.go View 1 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 4
dimitern
Please take a look.
10 years, 8 months ago (2013-08-16 15:34:02 UTC) #1
natefinch
LGTM modulo a couple really minor changes https://codereview.appspot.com/13055043/diff/1/state/relationunit.go File state/relationunit.go (right): https://codereview.appspot.com/13055043/diff/1/state/relationunit.go#newcode318 state/relationunit.go:318: return count ...
10 years, 8 months ago (2013-08-16 16:48:12 UTC) #2
fwereade
comments mostly as discussed online https://codereview.appspot.com/13055043/diff/1/state/api/params/internal.go File state/api/params/internal.go (right): https://codereview.appspot.com/13055043/diff/1/state/api/params/internal.go#newcode114 state/api/params/internal.go:114: Settings Settings I think ...
10 years, 8 months ago (2013-08-19 09:41:50 UTC) #3
dimitern
10 years, 8 months ago (2013-08-19 10:46:59 UTC) #4
Please take a look.

https://codereview.appspot.com/13055043/diff/1/state/api/params/internal.go
File state/api/params/internal.go (right):

https://codereview.appspot.com/13055043/diff/1/state/api/params/internal.go#n...
state/api/params/internal.go:114: Settings Settings
On 2013/08/19 09:41:50, fwereade wrote:
> I think this should be a map[string]string (we can use "" to signify deletes,
> it's how it works already, will save us a bit of code in uniter and jujuc
> eventually, I think).

Done.

https://codereview.appspot.com/13055043/diff/1/state/apiserver/uniter/uniter.go
File state/apiserver/uniter/uniter.go (right):

https://codereview.appspot.com/13055043/diff/1/state/apiserver/uniter/uniter....
state/apiserver/uniter/uniter.go:631: // EnvironConfig() just to get the
provider type.
On 2013/08/19 09:41:50, fwereade wrote:
> Maybe add a note that it might be completely unnecessary once we have machine
> addresses properly available.

Done.

https://codereview.appspot.com/13055043/diff/1/state/apiserver/uniter/uniter....
state/apiserver/uniter/uniter.go:644: func (u *UniterAPI) EnterScope(args
params.RelationUnitsSettings) (params.ErrorResults, error) {
On 2013/08/19 09:41:50, fwereade wrote:
> I don't think the settings need to come up here -- just grab PrivateAddress
from
> the unit and poke them in directly inside this method, and call it with
> RelationUnits alone.

Done.

https://codereview.appspot.com/13055043/diff/1/state/apiserver/uniter/uniter....
state/apiserver/uniter/uniter.go:685: func (u *UniterAPI) ReadSettings(args
params.RelationUnitPairs) (params.SettingsResults, error) {
On 2013/08/19 09:41:50, fwereade wrote:
> As discussed, let's break this into (approximately) ReadSettings(rel, unit)
and
> ReadRemoteSettings(rel, unit, remote)

Done.

https://codereview.appspot.com/13055043/diff/1/state/apiserver/uniter/uniter....
state/apiserver/uniter/uniter.go:713: func (u *UniterAPI) WriteSettings(args
params.RelationUnitsSettings) (params.ErrorResults, error) {
On 2013/08/19 09:41:50, fwereade wrote:
> UpdateSettings would be nicer.

Done.

https://codereview.appspot.com/13055043/diff/1/state/relationunit.go
File state/relationunit.go (right):

https://codereview.appspot.com/13055043/diff/1/state/relationunit.go#newcode318
state/relationunit.go:318: return count != 0
On 2013/08/16 16:48:12, nate.finch wrote:
> Can you make this count > 0 just to soothe my paranoid brain?

Deal :)

https://codereview.appspot.com/13055043/diff/1/state/relationunit_test.go
File state/relationunit_test.go (right):

https://codereview.appspot.com/13055043/diff/1/state/relationunit_test.go#new...
state/relationunit_test.go:59: c.Assert(pr.ru0.InScope(), Equals, false)
On 2013/08/16 16:48:12, nate.finch wrote:
> there's a IsFalse check in juju-core/testing/checkers that produces better
> output

Yes, but this is an old test module, which I didn't want to change altogether. I
can do it in a follow-up, if you insist.

https://codereview.appspot.com/13055043/diff/1/state/relationunit_test.go#new...
state/relationunit_test.go:81: c.Assert(pr.ru0.InScope(), Equals, true)
On 2013/08/16 16:48:12, nate.finch wrote:
> as above, but IsTrue, obviously ... same below here

See above.

https://codereview.appspot.com/13055043/diff/1/worker/uniter/modes.go
File worker/uniter/modes.go (right):

https://codereview.appspot.com/13055043/diff/1/worker/uniter/modes.go#newcode31
worker/uniter/modes.go:31: // block to use st.ProviderType() instead of calling
st.EnvironConfig.
On 2013/08/19 09:41:50, fwereade wrote:
> more like "TODO we might be able to drop all this address stuff entirely" :)

Done.
Sign in to reply to this message.

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