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

Issue 11529043: various: Use Long/ShortWait

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by rog
Modified:
10 years, 9 months ago
Reviewers:
dimitern, mp+175621, wallyworld
Visibility:
Public.

Description

various: Use Long/ShortWait I tracked down all the references in our test suite to time.Milliseconds and updated the references to use testing.ShortWait and testing.LongWait where appropriate. This also bumps the default LongWait timeout from 500ms to 1.0s. The argument is: 1) LongWait is used where it should never actually timeout 2) We've encountered some reliability issues on go-bot, so lets bump this up a little bit and see if it gives us more security margin. [Re-proposed to take this forward and land it - rog] https://code.launchpad.net/~rogpeppe/juju-core/340-jameinel-long-timeouts/+merge/175621 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : various: Use Long/ShortWait #

Total comments: 11

Patch Set 3 : various: Use Long/ShortWait #

Patch Set 4 : various: Use Long/ShortWait #

Total comments: 11
Unified diffs Side-by-side diffs Delta from patch set Stats (+141 lines, -115 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/publish_test.go View 1 2 3 chunks +2 lines, -3 lines 0 comments Download
M cmd/juju/status_test.go View 5 chunks +6 lines, -5 lines 0 comments Download
M cmd/jujud/deploy_test.go View 3 chunks +9 lines, -6 lines 0 comments Download
M cmd/jujud/unit_test.go View 1 chunk +1 line, -1 line 0 comments Download
M cmd/jujud/upgrade_test.go View 5 chunks +5 lines, -4 lines 0 comments Download
M downloader/downloader_test.go View 1 chunk +1 line, -1 line 0 comments Download
M state/api/watcher/watcher_test.go View 2 chunks +1 line, -5 lines 0 comments Download
M state/machine_test.go View 1 2 3 chunks +3 lines, -4 lines 2 comments Download
M state/presence/presence_test.go View 1 2 3 6 chunks +11 lines, -6 lines 0 comments Download
M state/relationunit_test.go View 3 chunks +3 lines, -2 lines 0 comments Download
M state/state_test.go View 3 chunks +3 lines, -3 lines 0 comments Download
M state/unit_test.go View 1 2 3 chunks +3 lines, -4 lines 1 comment Download
M state/watcher/watcher_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M store/mgo_test.go View 1 2 2 chunks +5 lines, -2 lines 0 comments Download
M testing/constants.go View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M utils/fslock/fslock_test.go View 2 chunks +2 lines, -2 lines 0 comments Download
M worker/cleaner/cleaner_test.go View 2 chunks +6 lines, -4 lines 2 comments Download
M worker/deployer/deployer_test.go View 1 chunk +2 lines, -2 lines 2 comments Download
M worker/firewaller/firewaller_test.go View 1 2 4 chunks +8 lines, -7 lines 0 comments Download
M worker/provisioner/lxc-broker_test.go View 1 2 4 chunks +5 lines, -5 lines 0 comments Download
M worker/provisioner/provisioner_test.go View 1 6 chunks +10 lines, -6 lines 4 comments Download
M worker/uniter/charm/charm_test.go View 2 chunks +8 lines, -6 lines 0 comments Download
M worker/uniter/jujuc/server_test.go View 2 chunks +8 lines, -6 lines 0 comments Download
M worker/uniter/relation/hookqueue_test.go View 1 4 chunks +9 lines, -7 lines 0 comments Download
M worker/uniter/relationer_test.go View 6 chunks +17 lines, -13 lines 0 comments Download
M worker/uniter/uniter_test.go View 1 8 chunks +8 lines, -8 lines 0 comments Download

Messages

Total messages: 6
rog
Please take a look.
10 years, 9 months ago (2013-07-18 16:32:23 UTC) #1
dimitern
LGTM, although some replacements seem a bit arbitrary: previously some places now using ShortWait had ...
10 years, 9 months ago (2013-07-18 16:44:05 UTC) #2
wallyworld
LGTM. I'm ok with the timeouts being changed to be consistent. I agree with the ...
10 years, 9 months ago (2013-07-19 07:32:49 UTC) #3
rog
Please take a look. https://codereview.appspot.com/11529043/diff/3001/state/presence/presence_test.go File state/presence/presence_test.go (right): https://codereview.appspot.com/11529043/diff/3001/state/presence/presence_test.go#newcode410 state/presence/presence_test.go:410: case <-time.After(testing.ShortWait): On 2013/07/18 16:44:05, ...
10 years, 9 months ago (2013-07-19 09:21:51 UTC) #4
dimitern
LGTM with a few suggestions. Nice to see some of the regular test paths now ...
10 years, 9 months ago (2013-07-19 09:31:52 UTC) #5
rog
10 years, 9 months ago (2013-07-19 09:37:36 UTC) #6
https://codereview.appspot.com/11529043/diff/33002/state/machine_test.go
File state/machine_test.go (right):

https://codereview.appspot.com/11529043/diff/33002/state/machine_test.go#newc...
state/machine_test.go:285: err = s.machine.WaitAgentAlive(coretesting.LongWait)
On 2013/07/19 09:31:52, dimitern wrote:
> Are you sure this shouldn't be ShortWait as well?

no - in this case we expect the operation to succeed, so the LongWait delay
should never happen.

https://codereview.appspot.com/11529043/diff/33002/worker/cleaner/cleaner_tes...
File worker/cleaner/cleaner_test.go (right):

https://codereview.appspot.com/11529043/diff/33002/worker/cleaner/cleaner_tes...
worker/cleaner/cleaner_test.go:64: case <-timeout:
On 2013/07/19 09:31:52, dimitern wrote:
> case <-time.After(coretesting.LongWait):
> instead (and get rid of timeout) ?

no - we want to receive all the changes within the timeout; hence we want a
timeout for the entire duration of the loop, not just one iteration.

anyway, this CL isn't about refactoring test logic, just unifying timeouts.

https://codereview.appspot.com/11529043/diff/33002/worker/deployer/deployer_t...
File worker/deployer/deployer_test.go (right):

https://codereview.appspot.com/11529043/diff/33002/worker/deployer/deployer_t...
worker/deployer/deployer_test.go:232: case <-timeout:
On 2013/07/19 09:31:52, dimitern wrote:
> ditto

definitely not - then it would never happen!

https://codereview.appspot.com/11529043/diff/33002/worker/provisioner/provisi...
File worker/provisioner/provisioner_test.go (right):

https://codereview.appspot.com/11529043/diff/33002/worker/provisioner/provisi...
worker/provisioner/provisioner_test.go:230: case <-timeout:
On 2013/07/19 09:31:52, dimitern wrote:
> ditto

again, we want the timeout for the entire duration of the loop.

https://codereview.appspot.com/11529043/diff/33002/worker/provisioner/provisi...
worker/provisioner/provisioner_test.go:250: case <-timeout:
On 2013/07/19 09:31:52, dimitern wrote:
> ditto

ditto
Sign in to reply to this message.

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