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

Issue 7950043: uniter: fix flaky tests, poor isolation

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

Description

uniter: fix flaky tests, poor isolation The changed test case wasn't waiting for the right thing, because there wasn't anything clear to wait for; changed the uniter deploy code such that it only notifies remote state about a new charm *after* it's downloaded and verified it but still before the change is applied. I can then write the test such that I immediately request the uniter stop just after it starts installing the new charm -- a procedure it won't interrupt -- and thus delay the verifyCharm check until the charm is sure to have been deployed. This change has been verified by rogpeppe and frankban, both of whom saw the original failures and now no longer do. I also fixed up test isolation via Reset, which was kinda crackful before. https://code.launchpad.net/~fwereade/juju-core/fix-1157898/+merge/154765 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 7

Patch Set 2 : uniter: fix flaky tests, poor isolation #

Unified diffs Side-by-side diffs Delta from patch set Stats (+66 lines, -51 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M worker/uniter/context.go View 1 chunk +2 lines, -1 line 0 comments Download
M worker/uniter/jujuc/server.go View 1 chunk +1 line, -1 line 0 comments Download
M worker/uniter/uniter.go View 2 chunks +12 lines, -9 lines 0 comments Download
M worker/uniter/uniter_test.go View 1 5 chunks +49 lines, -40 lines 0 comments Download

Messages

Total messages: 4
fwereade
Please take a look.
11 years, 1 month ago (2013-03-21 17:30:53 UTC) #1
jameinel
LGTM, though from your phrasing it sounds like we might still have a race. https://codereview.appspot.com/7950043/diff/1/worker/uniter/uniter_test.go ...
11 years, 1 month ago (2013-03-21 17:50:04 UTC) #2
rog
LGTM, nice to see this fixed. https://codereview.appspot.com/7950043/diff/1/worker/uniter/jujuc/server.go File worker/uniter/jujuc/server.go (right): https://codereview.appspot.com/7950043/diff/1/worker/uniter/jujuc/server.go#newcode102 worker/uniter/jujuc/server.go:102: log.Infof("worker/uniter/jujuc: running hook ...
11 years, 1 month ago (2013-03-22 08:13:28 UTC) #3
fwereade
11 years, 1 month ago (2013-03-22 09:53:42 UTC) #4
*** Submitted:

uniter: fix flaky tests, poor isolation

The changed test case wasn't waiting for the right thing, because there
wasn't anything clear to wait for; changed the uniter deploy code such
that it only notifies remote state about a new charm *after* it's downloaded
and verified it but still before the change is applied. I can then write the
test such that I immediately request the uniter stop just after it starts
installing the new charm -- a procedure it won't interrupt -- and thus delay
the verifyCharm check until the charm is sure to have been deployed.

This change has been verified by rogpeppe and frankban, both of whom saw the
original failures and now no longer do.

I also fixed up test isolation via Reset, which was kinda crackful before.

R=jameinel, rog
CC=
https://codereview.appspot.com/7950043

https://codereview.appspot.com/7950043/diff/1/worker/uniter/uniter_test.go
File worker/uniter/uniter_test.go (right):

https://codereview.appspot.com/7950043/diff/1/worker/uniter/uniter_test.go#ne...
worker/uniter/uniter_test.go:81: coretesting.Server.Flush()
On 2013/03/22 08:13:29, rog wrote:
> shouldn't this be in TearDownTest too? or is it implicit in
> JujuConnSuite.TearDownTest?

I think it should be, thanks.

https://codereview.appspot.com/7950043/diff/1/worker/uniter/uniter_test.go#ne...
worker/uniter/uniter_test.go:581: // the charm state on disk is as we expect.
On 2013/03/21 17:50:04, jameinel wrote:
> From your coverletter, it sounded like we might still have a race condition
(if
> the charm installs faster than we can stop the uniter). Is this true?

Doesn't matter how fast we install. The problem was purely in checking we had
done so before we were guaranteed to have done so; being early was wrong, but we
can be as late as we like and it's still not a race because we're checking for a
state that persists until next perturbed (eg by the following resolveError).
Sign in to reply to this message.

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