test: backport SleepTillNextMinute

This commit is contained in:
Mathieu Fenniak 2026-01-06 10:57:14 -07:00
parent bc402472e8
commit 09c95df7a4
No known key found for this signature in database

View file

@ -7,6 +7,7 @@ import (
"net/http"
"net/http/httptest"
"strings"
"time"
"forgejo.org/modules/json"
)
@ -46,3 +47,9 @@ func MockProtect[T any](p *T) (reset func()) {
old := *p
return func() { *p = old }
}
// When this is called, sleep until the truncated unix time to a minute was
// increased by one.
func SleepTillNextMinute() {
time.Sleep(time.Minute - time.Since(time.Now().Truncate(time.Minute)))
}