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

Issue 8034043: state: add new peer relations on upgrade (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 1 month ago by dimitern
Modified:
11 years, 1 month ago
Reviewers:
mp+155562
Visibility:
Public.

Description

state: add new peer relations on upgrade When setiing a serivce's charm on upgrade, new peer relations are now added as part of the same transaction. Slight refactoring of AddService is done as well, extracting common code now used by both AS() and service.SetCharm. Refactored testing Add*Charm() calls to use more generic code. In a follow-up it'll be improved further. https://code.launchpad.net/~dimitern/juju-core/017-upgrade-charm-add-new-peer-relations/+merge/155562 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: add new peer relations on upgrade #

Total comments: 9

Patch Set 3 : state: add new peer relations on upgrade #

Total comments: 8

Patch Set 4 : state: add new peer relations on upgrade #

Unified diffs Side-by-side diffs Delta from patch set Stats (+146 lines, -29 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M state/conn_test.go View 1 chunk +7 lines, -1 line 0 comments Download
M state/megawatcher_internal_test.go View 1 chunk +3 lines, -3 lines 0 comments Download
M state/service.go View 1 2 3 2 chunks +37 lines, -0 lines 0 comments Download
M state/service_test.go View 1 2 3 1 chunk +59 lines, -0 lines 0 comments Download
M state/state.go View 2 chunks +38 lines, -25 lines 0 comments Download

Messages

Total messages: 9
dimitern
Please take a look.
11 years, 1 month ago (2013-03-26 17:24:39 UTC) #1
rog
as discussed online, please could you make sure the revised tests in state fix the ...
11 years, 1 month ago (2013-03-26 17:41:57 UTC) #2
dimitern
On 2013/03/26 17:41:57, rog wrote: > as discussed online, please could you make sure the ...
11 years, 1 month ago (2013-03-27 09:31:38 UTC) #3
dimitern
Please take a look.
11 years, 1 month ago (2013-03-27 09:32:21 UTC) #4
fwereade
logic looks good but I'd prefer to rework the tests a bit, ping me to ...
11 years, 1 month ago (2013-03-27 09:49:47 UTC) #5
rog
LGTM when william's happy. https://codereview.appspot.com/8034043/diff/5001/state/service.go File state/service.go (right): https://codereview.appspot.com/8034043/diff/5001/state/service.go#newcode311 state/service.go:311: func (s *Service) peerRelationsDifference(otherMeta *charm.Meta) ...
11 years, 1 month ago (2013-03-27 11:10:17 UTC) #6
dimitern
Please take a look. https://codereview.appspot.com/8034043/diff/5001/state/service.go File state/service.go (right): https://codereview.appspot.com/8034043/diff/5001/state/service.go#newcode311 state/service.go:311: func (s *Service) peerRelationsDifference(otherMeta *charm.Meta) ...
11 years, 1 month ago (2013-03-27 11:26:27 UTC) #7
fwereade
LGTM with trivials https://codereview.appspot.com/8034043/diff/13001/state/service.go File state/service.go (right): https://codereview.appspot.com/8034043/diff/13001/state/service.go#newcode314 state/service.go:314: panic("newMeta is nil; cannot determine new ...
11 years, 1 month ago (2013-03-27 11:45:00 UTC) #8
dimitern
11 years, 1 month ago (2013-03-27 12:00:56 UTC) #9
*** Submitted:

state: add new peer relations on upgrade

When setiing a serivce's charm on upgrade, new
peer relations are now added as part of the same
transaction.

Slight refactoring of AddService is done as well,
extracting common code now used by both AS() and
service.SetCharm.

Refactored testing Add*Charm() calls to use more
generic code. In a follow-up it'll be improved
further.

R=rog, fwereade
CC=
https://codereview.appspot.com/8034043

https://codereview.appspot.com/8034043/diff/13001/state/service.go
File state/service.go (right):

https://codereview.appspot.com/8034043/diff/13001/state/service.go#newcode314
state/service.go:314: panic("newMeta is nil; cannot determine new peer
relations")
On 2013/03/27 11:45:00, fwereade wrote:
> I wouldn't even bother with this, the usual panic should give us enough
context.

Done.

https://codereview.appspot.com/8034043/diff/13001/state/service_test.go
File state/service_test.go (right):

https://codereview.appspot.com/8034043/diff/13001/state/service_test.go#newco...
state/service_test.go:257: func (s *ServiceSuite) assertServiceRelations(c *C,
svc *state.Service, expectedKeys []string) []*state.Relation {
On 2013/03/27 11:45:00, fwereade wrote:
> consider `expectedKeys ...string` for slightly neater usage at call sites

Done.

https://codereview.appspot.com/8034043/diff/13001/state/service_test.go#newco...
state/service_test.go:260: c.Assert(rels, HasLen, len(expectedKeys))
On 2013/03/27 11:45:00, fwereade wrote:
> Maybe drop the len checks; just sort both string slices and DeepEquals them.
> (clearer errors when they go wrong)

Done.

https://codereview.appspot.com/8034043/diff/13001/state/service_test.go#newco...
state/service_test.go:288: 
On 2013/03/27 11:45:00, fwereade wrote:
> // Check state consistency by attempting to destroy the service.

Done.
Sign in to reply to this message.

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