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

Issue 6549045: state: implement Unit.AssignToUnusedMachine

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 7 months ago by rog
Modified:
11 years, 7 months ago
Reviewers:
niemeyer, mp+125527, TheMue
Visibility:
Public.

Description

state: implement Unit.AssignToUnusedMachine https://code.launchpad.net/~rogpeppe/juju-core/075-assign-to-unused/+merge/125527 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: implement Unit.AssignToUnusedMachine #

Total comments: 17

Patch Set 3 : state: implement Unit.AssignToUnusedMachine #

Patch Set 4 : state: implement Unit.AssignToUnusedMachine #

Patch Set 5 : state: implement Unit.AssignToUnusedMachine #

Patch Set 6 : state: implement Unit.AssignToUnusedMachine #

Total comments: 20
Unified diffs Side-by-side diffs Delta from patch set Stats (+212 lines, -18 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M state/assign_test.go View 2 chunks +125 lines, -8 lines 19 comments Download
M state/tools_test.go View 1 chunk +1 line, -1 line 0 comments Download
M state/unit.go View 1 2 3 4 chunks +84 lines, -9 lines 1 comment Download

Messages

Total messages: 8
rog
Please take a look.
11 years, 7 months ago (2012-09-20 16:38:52 UTC) #1
TheMue
On 2012/09/20 16:38:52, rog wrote: > Please take a look. LGTM
11 years, 7 months ago (2012-09-20 16:58:45 UTC) #2
rog
Please take a look.
11 years, 7 months ago (2012-09-20 17:09:59 UTC) #3
niemeyer
This looks very good, actually. Some minor comments below. Will look at the tests tomorrow. ...
11 years, 7 months ago (2012-09-20 17:15:37 UTC) #4
rog
Please take a look. https://codereview.appspot.com/6549045/diff/2001/state/unit.go File state/unit.go (right): https://codereview.appspot.com/6549045/diff/2001/state/unit.go#newcode403 state/unit.go:403: cannotAssignErr = errors.New("unit cannot be ...
11 years, 7 months ago (2012-09-21 08:35:19 UTC) #5
rog
*** Submitted: state: implement Unit.AssignToUnusedMachine R=TheMue, niemeyer CC= https://codereview.appspot.com/6549045
11 years, 7 months ago (2012-09-21 08:40:26 UTC) #6
niemeyer
https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go File state/assign_test.go (right): https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go#newcode21 state/assign_test.go:21: s.service, err = s.State.AddService("wordpress", s.charm) I think the fact ...
11 years, 7 months ago (2012-09-21 09:28:13 UTC) #7
rog
11 years, 7 months ago (2012-09-21 10:34:34 UTC) #8
Comments addressed in https://codereview.appspot.com/6550052

https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go
File state/assign_test.go (right):

https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go#newcode21
state/assign_test.go:21: s.service, err = s.State.AddService("wordpress",
s.charm)
On 2012/09/21 09:28:13, niemeyer wrote:
> I think the fact we have suite-provided data here is both confusing tests and
> making them more fragile. The test TestAssignUnitToUnusedMachineOnlyZero for
> example, assumes that there's an unused machine zero, which means that
changing
> SetUpTest in an apparently innocent way could end up disabling the test
> inadvertently.
> 
> I suggest we drop the data here, and make every test create their own state,
so
> that we have all in context. So if we have multiple
> machines/services/units/whatever, they are all visible in the test itself.

done. this also has the nice effect that we also test AssignUnit to machine 0
which should not be special in that context.

https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go#newcod...
state/assign_test.go:156: func (s *AssignSuite) TestAssignMachineWhenDying(c *C)
{
On 2012/09/21 09:28:13, niemeyer wrote:
> This test is really multiple tests bundled into a single one. Splitting them
off
> into sub-test would be great.

Done.

https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go#newcod...
state/assign_test.go:264: // TODO s.unit.Die
On 2012/09/21 09:28:13, niemeyer wrote:
> ?

yeah. did the TODO :-)

https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go#newcod...
state/assign_test.go:303: c.Assert(err, ErrorMatches, `all machines in use`)
On 2012/09/21 09:28:13, niemeyer wrote:
> The sequence in this test is a nice one.

cool.

https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go#newcod...
state/assign_test.go:306: func (s *AssignSuite)
TestAssignUnitToUnusedMachineWithChangingService(c *C) {
On 2012/09/21 09:28:13, niemeyer wrote:
> s/Changing/Removed/

Done.

https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go#newcod...
state/assign_test.go:307: // Check for a 'state changed' error if a service is
manipulated
On 2012/09/21 09:28:13, niemeyer wrote:
> // Fail if service is removed.

Done.

https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go#newcod...
state/assign_test.go:320: func (s *AssignSuite)
TestAssignUnitToUnusedMachineWithChangingUnit(c *C) {
On 2012/09/21 09:28:13, niemeyer wrote:
> s/Changing/Removed/

Done.

https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go#newcod...
state/assign_test.go:322: // during reuse.
On 2012/09/21 09:28:13, niemeyer wrote:
> // Fail if unit is removed.

Done.

https://codereview.appspot.com/6549045/diff/12001/state/assign_test.go#newcod...
state/assign_test.go:334: func (s *AssignSuite)
TestAssignUnitToUnusedMachineOnlyZero(c *C) {
On 2012/09/21 09:28:13, niemeyer wrote:
> As mentioned above, we definitely need to have some logic here that verifies
> that we do have machine 0 unused.  Otherwise the harness can be modified and
> this test would be inadvertently disabled.

Done.
Sign in to reply to this message.

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