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

Issue 12175043: state: add AgentEntity

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

Description

state: add AgentEntity It collects together the methods we expect an agent to use on Machine and Unit. https://code.launchpad.net/~rogpeppe/juju-core/356-state-agent-entity/+merge/177892 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: add AgentEntity #

Total comments: 26

Patch Set 3 : state: add AgentEntity #

Patch Set 4 : state: add AgentEntity #

Unified diffs Side-by-side diffs Delta from patch set Stats (+72 lines, -21 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M state/apiserver/common/password_test.go View 1 2 3 1 chunk +3 lines, -12 lines 0 comments Download
M state/apiserver/upgrader/upgrader.go View 1 chunk +1 line, -2 lines 0 comments Download
M state/machine.go View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M state/state.go View 1 2 3 5 chunks +43 lines, -7 lines 0 comments Download
M state/state_test.go View 1 2 3 1 chunk +19 lines, -0 lines 0 comments Download
M state/unit.go View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 7
rog
Please take a look.
10 years, 9 months ago (2013-07-31 16:06:28 UTC) #1
dimitern
Looks good so far, but I have some comments below https://codereview.appspot.com/12175043/diff/3001/state/apiserver/common/password_test.go File state/apiserver/common/password_test.go (right): https://codereview.appspot.com/12175043/diff/3001/state/apiserver/common/password_test.go#newcode115 ...
10 years, 9 months ago (2013-07-31 16:13:39 UTC) #2
dimitern
After a discussion online, LGTM with the previous suggestions, except the one about embedded AgentEntity. ...
10 years, 9 months ago (2013-07-31 16:20:51 UTC) #3
rog
Please take a look. https://codereview.appspot.com/12175043/diff/3001/state/state.go File state/state.go (right): https://codereview.appspot.com/12175043/diff/3001/state/state.go#newcode555 state/state.go:555: return nil, fmt.Errorf("entity %q is ...
10 years, 9 months ago (2013-07-31 17:06:44 UTC) #4
fwereade
I'm pretty certain PasswordChanger's scope shouldn't be narrowed like this, so that bit NOT LGTM. ...
10 years, 9 months ago (2013-07-31 20:59:37 UTC) #5
rog
Please take a look. https://codereview.appspot.com/12175043/diff/3001/state/state.go File state/state.go (right): https://codereview.appspot.com/12175043/diff/3001/state/state.go#newcode477 state/state.go:477: MongoPassworder On 2013/07/31 20:59:37, fwereade ...
10 years, 9 months ago (2013-08-01 15:41:38 UTC) #6
fwereade
10 years, 9 months ago (2013-08-02 10:52:30 UTC) #7
LGTM

https://codereview.appspot.com/12175043/diff/3001/state/state.go
File state/state.go (right):

https://codereview.appspot.com/12175043/diff/3001/state/state.go#newcode477
state/state.go:477: MongoPassworder
On 2013/08/01 15:41:38, rog wrote:
> On 2013/07/31 20:59:37, fwereade wrote:
> > If this interface had to be created in order to put it in here, I'm not sure
> its
> > existence independent of AgentEntity is justified.
> 
> For exported interfaces, experience suggests it's a good idea to have either
all
> explicit methods or all embedded interfaces. Combining the two means there's
no
> way to access the agent-tools-specific methods on their own even if we want
> them. Even though I can see no current reason that we might want to do that,
I'd
> prefer to stick to that principle if possible (I can't see a particular down
> side).

The only downside is the multiplication of apparently-unnecessary entities. Not
too bothered, it just seemed a bit off to me.

https://codereview.appspot.com/12175043/diff/3001/state/state.go#newcode478
state/state.go:478: AgentTooler
On 2013/08/01 15:41:38, rog wrote:
> On 2013/07/31 20:59:37, fwereade wrote:
> > I don't think this interface has any independent value (much like Remover).
> > Doesn't need to change here, but expect my followup to drop stuff like that.
> 
> As above.

Likewise, its very existence gives the impression that it's meaningful to get or
set tools of, or to remove, anything that isn't implemented by an agent. But
quibble quibble, not really a big dealAFAICS.

https://codereview.appspot.com/12175043/diff/3001/state/state_test.go
File state/state_test.go (right):

https://codereview.appspot.com/12175043/diff/3001/state/state_test.go#newcode...
state/state_test.go:1569: c.Assert(e, gc.IsNil)
On 2013/08/01 15:41:38, rog wrote:
> On 2013/07/31 20:59:37, fwereade wrote:
> > Explicit tests for units too, please.
> 
> Is that actually useful? We're not testing Unit-specific logic here. This test
> gives 100% coverage of the logic in AgentEntity itself, and the static type
> checks (and the unit-specific tests) cover the rest AFAICS.
> 
> What am I missing?

As discussed online, that the test thus assumes the underlying State.entity
implementation, and that it's therefore brittle in the face of changes by
inexperienced devs. I guess I'm ok exporting Entity() alone, testing that hard,
and just casting to appropriate types where it's used... I'd really prefer
keeping the existing model and testing the various implementations explicitly,
to avoid all the downcasting elsewhere, but /shrug. I'll leave it to your
judgment, and we can iterate if and when we have to.
Sign in to reply to this message.

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