Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the non-deprecated SimpleIntervalClock fake kubeclock #199

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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