Documentation ¶
Index ¶
- Constants
- func Context(t *testing.T, dur time.Duration) context.Context
- func CreateTemp(t *testing.T, dir, pattern string) *os.File
- func Eventually(ctx context.Context, t testing.TB, ...) (done bool)
- func GenerateTLSCertificate(t testing.TB, commonName string) tls.Certificate
- func InCI() bool
- func SkipIfNotTiming(t *testing.T)
- func TempFile(t *testing.T, dir, pattern string) string
- type OAuth2Config
- type OAuth2TokenSource
Constants ¶
const ( WaitShort = 5 * time.Second WaitMedium = 10 * time.Second WaitLong = 15 * time.Second WaitSuperLong = 60 * time.Second )
Constants for timing out operations, usable for creating contexts that timeout or in require.Eventually.
const ( IntervalFast = 25 * time.Millisecond IntervalMedium = 250 * time.Millisecond IntervalSlow = time.Second )
Constants for delaying repeated operations, e.g. in require.Eventually.
Variables ¶
This section is empty.
Functions ¶
func CreateTemp ¶ added in v0.15.0
CreateTemp is a convenience function for creating a temporary file, like os.CreateTemp, but it also registers a cleanup function to close and remove the file.
func Eventually ¶ added in v0.8.3
func Eventually(ctx context.Context, t testing.TB, condition func(ctx context.Context) (done bool), tick time.Duration, msgAndArgs ...interface{}) (done bool)
Eventually is like require.Eventually except it allows passing a context into the condition. It is safe to use with `require.*`.
If ctx times out, the test will fail, but not immediately. It is the caller's responsibility to exit early if required.
It is the caller's responsibility to ensure that ctx has a deadline or timeout set. Eventually will panic if this is not the case in order to avoid potentially waiting forever.
condition is not run in a goroutine; use the provided context argument for cancellation if required.
func GenerateTLSCertificate ¶ added in v0.10.0
func GenerateTLSCertificate(t testing.TB, commonName string) tls.Certificate
func SkipIfNotTiming ¶ added in v0.23.1
Types ¶
type OAuth2Config ¶ added in v0.20.1
type OAuth2Config struct { Token *oauth2.Token TokenSourceFunc OAuth2TokenSource }
func (*OAuth2Config) AuthCodeURL ¶ added in v0.20.1
func (*OAuth2Config) AuthCodeURL(state string, _ ...oauth2.AuthCodeOption) string
func (*OAuth2Config) Exchange ¶ added in v0.20.1
func (c *OAuth2Config) Exchange(_ context.Context, _ string, _ ...oauth2.AuthCodeOption) (*oauth2.Token, error)
func (*OAuth2Config) TokenSource ¶ added in v0.20.1
func (c *OAuth2Config) TokenSource(_ context.Context, _ *oauth2.Token) oauth2.TokenSource