run 'go get -u; make revendor'
Signed-off-by: Stephan Renatus <srenatus@chef.io>
This commit is contained in:
14
vendor/github.com/jonboulle/clockwork/README.md
generated
vendored
14
vendor/github.com/jonboulle/clockwork/README.md
generated
vendored
@@ -2,7 +2,7 @@ clockwork
|
||||
=========
|
||||
|
||||
[](https://travis-ci.org/jonboulle/clockwork)
|
||||
[](http://godoc.org/github.com/jonboulle/clockwork)
|
||||
[](http://godoc.org/github.com/jonboulle/clockwork)
|
||||
|
||||
a simple fake clock for golang
|
||||
|
||||
@@ -35,12 +35,7 @@ func TestMyFunc(t *testing.T) {
|
||||
c := clockwork.NewFakeClock()
|
||||
|
||||
// Start our sleepy function
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
my_func(c)
|
||||
wg.Done()
|
||||
}()
|
||||
my_func(c)
|
||||
|
||||
// Ensure we wait until my_func is sleeping
|
||||
c.BlockUntil(1)
|
||||
@@ -48,10 +43,7 @@ func TestMyFunc(t *testing.T) {
|
||||
assert_state()
|
||||
|
||||
// Advance the FakeClock forward in time
|
||||
c.Advance(3 * time.Second)
|
||||
|
||||
// Wait until the function completes
|
||||
wg.Wait()
|
||||
c.Advance(3)
|
||||
|
||||
assert_state()
|
||||
}
|
||||
|
10
vendor/github.com/jonboulle/clockwork/clockwork.go
generated
vendored
10
vendor/github.com/jonboulle/clockwork/clockwork.go
generated
vendored
@@ -11,7 +11,6 @@ type Clock interface {
|
||||
After(d time.Duration) <-chan time.Time
|
||||
Sleep(d time.Duration)
|
||||
Now() time.Time
|
||||
Since(t time.Time) time.Duration
|
||||
}
|
||||
|
||||
// FakeClock provides an interface for a clock which can be
|
||||
@@ -61,10 +60,6 @@ func (rc *realClock) Now() time.Time {
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
func (rc *realClock) Since(t time.Time) time.Duration {
|
||||
return rc.Now().Sub(t)
|
||||
}
|
||||
|
||||
type fakeClock struct {
|
||||
sleepers []*sleeper
|
||||
blockers []*blocker
|
||||
@@ -135,11 +130,6 @@ func (fc *fakeClock) Now() time.Time {
|
||||
return t
|
||||
}
|
||||
|
||||
// Since returns the duration that has passed since the given time on the fakeClock
|
||||
func (fc *fakeClock) Since(t time.Time) time.Duration {
|
||||
return fc.Now().Sub(t)
|
||||
}
|
||||
|
||||
// Advance advances fakeClock to a new point in time, ensuring channels from any
|
||||
// previous invocations of After are notified appropriately before returning
|
||||
func (fc *fakeClock) Advance(d time.Duration) {
|
||||
|
Reference in New Issue
Block a user