Update testing.Clock to improve robustness #113

Merged
merged 1 commit into from Sep 30, 2016

Conversation

Projects
None yet
4 participants
Contributor

reedobrien commented Sep 29, 2016

Adds a WaitAdvance method which ensures that there is something in
clock.waiting before actually advancing the time. Addtionally cause
Advance to log a debug message if it Advances time when clock.waiting
is empty.

Refs: https://bugs.launchpad.net/juju/+bug/1607044

QA:

  1. Run the unit tests and ensure they all pass.
"sync"
"time"
+ gc "gopkg.in/check.v1"
+
"github.com/juju/testing"
@anastasiamac

anastasiamac Sep 30, 2016

Member

import block :D

@reedobrien

reedobrien Sep 30, 2016

Contributor

As discussed in person at the sprint, this conforms with how block are separated in juju/cmd and other libraries outside of juju/juju. Also, it is how goimports auto formats imports. :)

clock.go
+ }
+ time.Sleep(pause)
+ }
+ return errors.Errorf("no timers added after waiting %s", w.String())
@babbageclunk

babbageclunk Sep 30, 2016

Member

This needs to be updated for the n waiters change. It's probably worth saying how many waiters there were. Of course, then you'll get the irritating situation where one shows up between the last check and the report: "waiting for 10 timers, only 10 seen".

@reedobrien

reedobrien Sep 30, 2016

Contributor

updated error message

reedobrien added a commit to reedobrien/juju-testing that referenced this pull request Sep 30, 2016

Update testing.Clock to improve robustness
Adds a WaitAdvance method which ensures that there is something in
clock.waiting before actually advancing the time. Addtionally cause
Advance to log a debug message if it Advances time when clock.waiting
is empty.

More information about this can be found on the wiki: cf.
https://github.com/juju/juju/wiki/Intermittent-failures
There was also discussion on IRC about the use of alarms; cf.
https://irclogs.ubuntu.com/2016/09/30/%23juju-dev.txt

Refs: https://bugs.launchpad.net/juju/+bug/1607044
Contributor

reedobrien commented Sep 30, 2016

$$merge$$

Contributor

jujubot commented Sep 30, 2016

@jujubot jujubot merged commit 692d58e into juju:master Sep 30, 2016

@reedobrien reedobrien deleted the reedobrien:lp/1607044_clockadvance-misses-somtimes branch Sep 30, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment