mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-13 06:20:24 +00:00
test: backport SleepTillNextMinute
This commit is contained in:
parent
bc402472e8
commit
09c95df7a4
1 changed files with 7 additions and 0 deletions
|
|
@ -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)))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue