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

Issue 96110043: Add some developer docs for writing tests.

Can't Edit
Can't Publish+Mail
Start Review
Created:
5 years, 9 months ago by thumper
Modified:
5 years, 9 months ago
Reviewers:
mp+218732, menn0, wallyworld, fwereade
Visibility:
Public.

Description

Add some developer docs for writing tests. Obviously there is a lot that could be written, but this is a start. https://code.launchpad.net/~thumper/juju-core/testing-docs/+merge/218732 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 16

Patch Set 2 : Add some developer docs for writing tests. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+306 lines, -0 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
A doc/how-to-write-tests.txt View 1 1 chunk +304 lines, -0 lines 0 comments Download

Messages

Total messages: 6
thumper
Please take a look.
5 years, 9 months ago (2014-05-08 03:46:09 UTC) #1
wallyworld
A great start. I'd also mention github.com/juju/testing/checkers LGTM. We should get this in and iterate ...
5 years, 9 months ago (2014-05-08 03:56:56 UTC) #2
menn0
Minor fixes https://codereview.appspot.com/96110043/diff/1/doc/how-to-write-tests.txt File doc/how-to-write-tests.txt (right): https://codereview.appspot.com/96110043/diff/1/doc/how-to-write-tests.txt#newcode165 doc/how-to-write-tests.txt:165: To create your new test suite composing ...
5 years, 9 months ago (2014-05-08 04:38:58 UTC) #3
thumper
https://codereview.appspot.com/96110043/diff/1/doc/how-to-write-tests.txt File doc/how-to-write-tests.txt (right): https://codereview.appspot.com/96110043/diff/1/doc/how-to-write-tests.txt#newcode165 doc/how-to-write-tests.txt:165: To create your new test suite composing one of ...
5 years, 9 months ago (2014-05-08 05:05:38 UTC) #4
fwereade
This is awesome. Not all my comments are necessarily directly actionable, in that they're complaints ...
5 years, 9 months ago (2014-05-08 05:34:49 UTC) #5
thumper
5 years, 9 months ago (2014-05-08 22:34:42 UTC) #6
Please take a look.

https://codereview.appspot.com/96110043/diff/1/doc/how-to-write-tests.txt
File doc/how-to-write-tests.txt (right):

https://codereview.appspot.com/96110043/diff/1/doc/how-to-write-tests.txt#new...
doc/how-to-write-tests.txt:119: // a pointer to that variable so we can patch it
in the tests.
On 2014/05/08 05:34:49, fwereade wrote:
> formatting

Done.

https://codereview.appspot.com/96110043/diff/1/doc/how-to-write-tests.txt#new...
doc/how-to-write-tests.txt:151: github.com/juju/testing, which brings in the
CleanupSute from the same.
On 2014/05/08 05:34:49, fwereade wrote:
> s/Sute/Suite/

Done.

https://codereview.appspot.com/96110043/diff/1/doc/how-to-write-tests.txt#new...
doc/how-to-write-tests.txt:159: JUJU_ENV, and JUJU_LOGGING_CONFIG environment
variables.
On 2014/05/08 05:34:49, fwereade wrote:
> The FakeHomeSuite should generally not be used, because it assumes a context
of
> a running (cmd/juju) client; almost all the code should avoid making this
> assumption, because it's actually generally going to run on an API server.

Perhaps that was the original intent, but it has been extended somewhat to allow
writing of custom files into the HOME directory, and the isolation of the
environment variables that juju cares about.

Perhaps we should split and isolate more.

https://codereview.appspot.com/96110043/diff/1/doc/how-to-write-tests.txt#new...
doc/how-to-write-tests.txt:162: api server.
On 2014/05/08 05:34:49, fwereade wrote:
> The JujuConnSuite is all fucked up, and should be used when you just don't
care
> about having coherent context available, you just kinda want everything and
> don't want to think too hard. State server? Client? Both? Whooo! Who cares!
> 
> Yeah, we should fix this; but in the meantime I want people to know it's at
> least somewhat bad/wrong, because then *maybe* someone will take it upon
> themselves to extract a saner subset of the functionality and start using
that;
> as it is it's all too easy to just allow the rot to gently spread without even
> knowing that's what you're doing.

Added a note to indicate that we aren't happy with it as it stands :-)

https://codereview.appspot.com/96110043/diff/1/doc/how-to-write-tests.txt#new...
doc/how-to-write-tests.txt:215: // of the test.
On 2014/05/08 05:34:49, fwereade wrote:
> Really, FWIW, I think we should always be clearing the env at the very start
of
> a test.

Is there not some part of the environment that we actually care about?

Pretty sure some expect bash.
Sign in to reply to this message.

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