Files
coder/testutil/ctx.go
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
220 B
Go
Raw Normal View History

2022-10-10 15:37:06 -05:00
package testutil
import (
"context"
"testing"
2023-03-23 17:42:20 -05:00
"time"
2022-10-10 15:37:06 -05:00
)
func Context(t testing.TB, dur time.Duration) context.Context {
2023-03-23 17:42:20 -05:00
ctx, cancel := context.WithTimeout(context.Background(), dur)
2022-10-10 15:37:06 -05:00
t.Cleanup(cancel)
2023-03-23 17:42:20 -05:00
return ctx
2022-10-10 15:37:06 -05:00
}