Files
compute-blade-agent/pkg/util/clock_mock.go
2023-07-17 07:01:54 +02:00

25 lines
511 B
Go

package util
import (
"time"
"github.com/stretchr/testify/mock"
)
// MockClock implements the Clock interface using the testify mock package.
type MockClock struct {
mock.Mock
}
// Now returns the current time.
func (mc *MockClock) Now() time.Time {
args := mc.Called()
return args.Get(0).(time.Time)
}
// After waits for the duration to elapse and then sends the current time
func (mc *MockClock) After(d time.Duration) <-chan time.Time {
args := mc.Called(d)
return args.Get(0).(chan time.Time)
}