Merge lp://qastaging/~bjornt/landscape-charm/integration-tests-no-hardcode-unit into lp://qastaging/~landscape/landscape-charm/trunk

Proposed by Björn Tillenius
Status: Merged
Approved by: Björn Tillenius
Approved revision: 321
Merged at revision: 310
Proposed branch: lp://qastaging/~bjornt/landscape-charm/integration-tests-no-hardcode-unit
Merge into: lp://qastaging/~landscape/landscape-charm/trunk
Diff against target: 252 lines (+61/-34)
3 files modified
tests/basic/test_service.py (+13/-13)
tests/helpers.py (+46/-21)
tests/layers.py (+2/-0)
To merge this branch: bzr merge lp://qastaging/~bjornt/landscape-charm/integration-tests-no-hardcode-unit
Reviewer Review Type Date Requested Status
Adam Collard (community) Approve
🤖 Landscape Builder test results Approve
Free Ekanayaka (community) Approve
Review via email: mp+261689@code.qastaging.launchpad.net

Commit message

Don't hardcode the unit ids in the integration tests.

The tests assumed that landscape-server/0 was always there. This is not
always true, especially not when we'll add a layer that destroys that
unit.

I also changed it so that error output is included from the 'juju ssh'
calls. Error output from the cron scripts was already included, but if
the actualy 'juju ssh' call failed, all you saw that the command exited
with error code 1, but you didn't see what the actual problem was.

Description of the change

Don't hardcode the unit ids in the integration tests.

The tests assumed that landscape-server/0 was always there. This is not
always true, especially not when we'll add a layer that destroys that
unit.

I have a branch where I add such a layer, which shows the problem solved
by this branch. But to reproduce it, what you can do is to take an
existing deploy and destroy all the machines. If you run the following
it will fail in trunk, but pass with this branch:

    LS_CHARM_SOURCE=lds-trunk-ppa zope-testrunner3 -vv --path tests/ --tests-pattern basic --layer NoCron

I also changed it so that error output is included from the 'juju ssh'
calls. Error output from the cron scripts was already included, but if
the actualy 'juju ssh' call failed, all you saw that the command exited
with error code 1, but you didn't see what the actual problem was.

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :
review: Approve (test results)
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

So I agree with the goal of making tests re-use existing setup as much as possible, for example if you want to run again tests against a non-fresh environment with zero or one unit (like you mention in the MP description).

However I'm not totally sure I want to have tests running against a non-stable ordering of the setup tests/layers, but I'll wait to see the follow-up branch.

With that in mind, I have an inline comment I'd like your input on.

review: Needs Information
Revision history for this message
Björn Tillenius (bjornt) :
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Ok, fair enough. +1 with a small nit

review: Approve
320. By Björn Tillenius

Clarify docstring.

Revision history for this message
Björn Tillenius (bjornt) :
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :
review: Approve (test results)
Revision history for this message
Adam Collard (adam-collard) wrote :

Looks good, just one suggestion about always using an empty stdin to avoid spurious failures.

review: Approve
Revision history for this message
Björn Tillenius (bjornt) :
321. By Björn Tillenius

Prevent stdin input from making tests fail.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches