extend fake clock

This commit is contained in:
Daniel Smith
2016-02-01 10:50:05 -08:00
parent 92ec286ecc
commit 4a7d70aef1
14 changed files with 181 additions and 40 deletions

View File

@@ -43,7 +43,7 @@ import (
// NewFakeControllerExpectationsLookup creates a fake store for PodExpectations.
func NewFakeControllerExpectationsLookup(ttl time.Duration) (*ControllerExpectations, *util.FakeClock) {
fakeTime := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
fakeClock := &util.FakeClock{Time: fakeTime}
fakeClock := util.NewFakeClock(fakeTime)
ttlPolicy := &cache.TTLPolicy{Ttl: ttl, Clock: fakeClock}
ttlStore := cache.NewFakeExpirationStore(
ExpKeyFunc, nil, ttlPolicy, fakeClock)
@@ -177,7 +177,7 @@ func TestControllerExpectations(t *testing.T) {
}
// Expectations have expired because of ttl
fakeClock.Time = fakeClock.Time.Add(ttl + 1)
fakeClock.Step(ttl + 1)
if !e.SatisfiedExpectations(rcKey) {
t.Errorf("Expectations should have expired but didn't")
}