Chore: Use TimeNow instead of time.Now in user sql store to make it testable (#54983)

This commit is contained in:
Misi
2022-09-09 18:43:14 +02:00
committed by GitHub
parent d5e28426ee
commit c5be9605a2
3 changed files with 28 additions and 22 deletions
+16
View File
@@ -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
}