diff --git a/cmd/vendor/github.com/jonboulle/clockwork/clockwork.go b/cmd/vendor/github.com/jonboulle/clockwork/clockwork.go index 4b6918b52..9ec96ed29 100644 --- a/cmd/vendor/github.com/jonboulle/clockwork/clockwork.go +++ b/cmd/vendor/github.com/jonboulle/clockwork/clockwork.go @@ -32,10 +32,17 @@ func NewRealClock() Clock { } // NewFakeClock returns a FakeClock implementation which can be -// manually advanced through time for testing. +// manually advanced through time for testing. The initial time of the +// FakeClock will be an arbitrary non-zero time. func NewFakeClock() FakeClock { + // use a fixture that does not fulfill Time.IsZero() + return NewFakeClockAt(time.Date(1984, time.April, 4, 0, 0, 0, 0, time.UTC)) +} + +// NewFakeClockAt returns a FakeClock initialised at the given time.Time. +func NewFakeClockAt(t time.Time) FakeClock { return &fakeClock{ - l: sync.RWMutex{}, + time: t, } } @@ -117,9 +124,10 @@ func (fc *fakeClock) Sleep(d time.Duration) { // Time returns the current time of the fakeClock func (fc *fakeClock) Now() time.Time { - fc.l.Lock() - defer fc.l.Unlock() - return fc.time + fc.l.RLock() + t := fc.time + fc.l.RUnlock() + return t } // Advance advances fakeClock to a new point in time, ensuring channels from any diff --git a/glide.lock b/glide.lock index 693b7cb11..30edcba38 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: c04a6b4fa79b3e780e38f875e3863551c8a7e5a1d1020b9a3a06268d50e592e3 -updated: 2016-08-15T15:51:12.533454067-07:00 +hash: 772308b285e752f35b2e87f75271501d23bbd9e72840dd1980fc6cf38a406b69 +updated: 2016-08-16T16:30:32.22550013-07:00 imports: - name: bitbucket.org/ww/goautoneg version: 75cd24fc2f2c2a2088577d12123ddee5f54e0675 @@ -64,7 +64,7 @@ imports: - name: github.com/inconshreveable/mousetrap version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 - name: github.com/jonboulle/clockwork - version: 72f9bd7c4e0c2a40055ab3d0f09654f730cce982 + version: 2eee05ed794112d45db504eb05aa693efd2b8b09 - name: github.com/kballard/go-shellquote version: d8ec1a69a250a17bb0e419c386eac1f3711dc142 - name: github.com/kr/pty diff --git a/glide.yaml b/glide.yaml index de0b409c4..fcf84eadf 100644 --- a/glide.yaml +++ b/glide.yaml @@ -62,7 +62,7 @@ import: - package: github.com/inconshreveable/mousetrap version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 - package: github.com/jonboulle/clockwork - version: 72f9bd7c4e0c2a40055ab3d0f09654f730cce982 + version: v0.1.0 - package: github.com/kballard/go-shellquote version: d8ec1a69a250a17bb0e419c386eac1f3711dc142 - package: github.com/kr/pty