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

Issue 8133045: state, cmd/juju: unit status changes, juju status (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+156181
Visibility:
Public.

Description

state, cmd/juju: unit status changes, juju status Unit.Status() was changed not to return an error and not to use AgentAlive() logic inside it, since this is only meaningful inside juju status command (the command was updated with the new correct logic). Also the juju status tests were completely refactored to be independent and more flexible. This is especially important for the upcoming changes to the status cmd to make it compatible with py-juju and will make adding extra features and testing them easier. https://code.launchpad.net/~dimitern/juju-core/020-state-fix-unit-status-juju-status/+merge/156181 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 14

Patch Set 2 : state, cmd/juju: unit status changes, juju status #

Total comments: 2

Patch Set 3 : state, cmd/juju: unit status changes, juju status #

Total comments: 6

Patch Set 4 : state, cmd/juju: unit status changes, juju status #

Unified diffs Side-by-side diffs Delta from patch set Stats (+454 lines, -320 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/builddb/main.go View 1 chunk +2 lines, -8 lines 0 comments Download
M cmd/juju/status.go View 1 2 chunks +17 lines, -7 lines 0 comments Download
M cmd/juju/status_test.go View 1 2 3 1 chunk +411 lines, -241 lines 0 comments Download
M cmd/jujud/unit_test.go View 1 1 chunk +1 line, -2 lines 0 comments Download
M juju/conn.go View 1 chunk +1 line, -5 lines 0 comments Download
M state/statecmd/resolved.go View 1 chunk +1 line, -5 lines 0 comments Download
M state/unit.go View 1 1 chunk +4 lines, -27 lines 0 comments Download
M state/unit_test.go View 1 1 chunk +14 lines, -23 lines 0 comments Download
M worker/uniter/uniter_test.go View 1 chunk +1 line, -2 lines 0 comments Download

Messages

Total messages: 7
dimitern
Please take a look.
11 years, 1 month ago (2013-03-29 15:16:07 UTC) #1
fwereade
This is awesome, thank you very much. I'd like one change to the tests, which ...
11 years, 1 month ago (2013-03-29 17:02:04 UTC) #2
dimitern
Please take a look. https://codereview.appspot.com/8133045/diff/1/cmd/juju/status.go File cmd/juju/status.go (right): https://codereview.appspot.com/8133045/diff/1/cmd/juju/status.go#newcode231 cmd/juju/status.go:231: r["status"] = status On 2013/03/29 ...
11 years, 1 month ago (2013-03-29 18:39:56 UTC) #3
fwereade
As stated online, I think that we could collapse the tests still further and keep ...
11 years, 1 month ago (2013-03-29 18:56:29 UTC) #4
dimitern
Please take a look. https://codereview.appspot.com/8133045/diff/6001/cmd/juju/status_test.go File cmd/juju/status_test.go (right): https://codereview.appspot.com/8133045/diff/6001/cmd/juju/status_test.go#newcode100 cmd/juju/status_test.go:100: expect{ On 2013/03/29 18:56:29, fwereade ...
11 years, 1 month ago (2013-03-29 19:10:44 UTC) #5
jameinel
LGTM Most of the patch seems just straightforward and mechanical of removing the AgentAlive call ...
11 years, 1 month ago (2013-03-31 12:03:08 UTC) #6
dimitern
11 years, 1 month ago (2013-04-01 09:12:23 UTC) #7
*** Submitted:

state, cmd/juju: unit status changes, juju status

Unit.Status() was changed not to return an error
and not to use AgentAlive() logic inside it, since
this is only meaningful inside juju status command
(the command was updated with the new correct logic).

Also the juju status tests were completely refactored
to be independent and more flexible. This is especially
important for the upcoming changes to the status cmd
to make it compatible with py-juju and will make adding
extra features and testing them easier.

R=fwereade, jameinel
CC=
https://codereview.appspot.com/8133045

https://codereview.appspot.com/8133045/diff/12001/cmd/juju/status_test.go
File cmd/juju/status_test.go (right):

https://codereview.appspot.com/8133045/diff/12001/cmd/juju/status_test.go#new...
cmd/juju/status_test.go:22: func runStatus(c *C, args ...string) (code int,
stderr, stdout []byte) {
On 2013/03/31 12:03:09, jameinel wrote:
> Offhand the ordering "code, stderr, stdout" looks a bit odd. It is fine if you
> like it, but maybe code,out,err or out,err,code might be more obvious. (It is
> just rare to have (stderr, stdout) rather than (stdout, stderr).
> 

Good point, done.

https://codereview.appspot.com/8133045/diff/12001/cmd/juju/status_test.go#new...
cmd/juju/status_test.go:271: 
On 2013/03/31 12:03:09, jameinel wrote:
> I'm trusting that the above is mechanical. If there is a piece you
specifically
> want reviewed, just point it out. But it *looks* like just
> s/map[string]interface{}/M/ which is great.

It mostly is, the only new test is the last case with agent-state "down", which
is now reported by the command, rather than the unit itself. Also renamed
"status", "info" -> "agent-state", "agent-state-info" to keep compatibility with
py-juju.

https://codereview.appspot.com/8133045/diff/12001/cmd/juju/status_test.go#new...
cmd/juju/status_test.go:441: }
On 2013/03/31 12:03:09, jameinel wrote:
> I don't quite understand why these are started in a goroutine, only to have it
> then work in lock-step because of the start channel.
> It doesn't seem to add anything other than indirection vs just having the loop
> inline with no goroutine.
> Maybe it allows for some parallelism if GOMAXPROCS >= 1. However, it makes it
a
> bit hard to figure out what is going on. (Imagine both formats failing because
> of a new attribute that ends up in both outputs, and then you have to unnest
the
> failing goroutine tracebacks, etc.)
> 
> Anyway, it isn't something you have to take out, but I'd like to understand
why
> it was useful.

The idea here is to test the already established scenario in state (previous
steps) with all supported formats concurrently. It was meant as a speed
improvement, but now I removed it, because the time difference between
sequential and concurrent approach as tested now is negligible.
Sign in to reply to this message.

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