Chore: Use TimeNow instead of time.Now in user sql store to make it testable (#54983)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package sqlstore
|
||||
|
||||
import "time"
|
||||
|
||||
// TimeNow makes it possible to test usage of time
|
||||
var TimeNow = time.Now
|
||||
|
||||
func MockTimeNow(constTime time.Time) {
|
||||
TimeNow = func() time.Time {
|
||||
return constTime
|
||||
}
|
||||
}
|
||||
|
||||
func ResetTimeNow() {
|
||||
TimeNow = time.Now
|
||||
}
|
||||
Reference in New Issue
Block a user