Skip to content

Commit

Permalink
Use the non-deprecated SimpleIntervalClock fake kubeclock (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
misberner committed Nov 11, 2022
1 parent 6f61067 commit 1375ea2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/internal/status/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

// clock is used to set status condition timestamps.
// This variable makes it easier to test conditions.
var clock kubeclock.Clock = &kubeclock.RealClock{}
var clock kubeclock.PassiveClock = &kubeclock.RealClock{}

// ConditionType is the type of the condition and is typically a CamelCased
// word or short phrase.
Expand Down
6 changes: 2 additions & 4 deletions pkg/internal/status/conditions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@ func init() {

func initConditions(init ...Condition) Conditions {
// Use the same initial time for all initial conditions
clock = kubeclock.NewFakeClock(initTime)
clock = kubeclock.NewFakePassiveClock(initTime)
conditions := Conditions{}
for _, c := range init {
conditions.SetCondition(c)
}

// Use an incrementing clock for the rest of the test
// This is deprecated but should be fine to use for now until we have a better solution
// nolint
clock = &kubeclock.IntervalClock{
clock = &kubeclock.SimpleIntervalClock{
Time: initTime,
Duration: clockInterval,
}
Expand Down

0 comments on commit 1375ea2

Please sign in to comment.