src/client/pkg/require/require.go
func NoErrorWithinT(tb testing.TB, t time.Duration, f func() error, msgAndArgs ...interface{}) {
	tb.Helper()
	errCh := make(chan error)
	go func() {
		// This goro will leak if the timeout is exceeded, but it's okay because the
		// test is failing anyway
		errCh <- f()
	}()
	select {
	case err := <-errCh:
		if err != nil {
			fatal(tb, msgAndArgs, "No error is expected but got %s", err.Error())
		}
	case <-time.After(t):
		fatal(tb, msgAndArgs, "operation did not finish within %s", t.String())
	}
}
func NoErrorWithinT(tb testing.TB, t time.Duration, f func() error, msgAndArgs ...interface{}) {
	tb.Helper()
	errCh := make(chan error)
	go func() {
		// This goro will leak if the timeout is exceeded, but it's okay because the
		// test is failing anyway
		errCh <- f()
	}()
	select {
	case err := <-errCh:
		if err != nil {
			fatal(tb, msgAndArgs, "No error is expected but got %s", err.Error())
		}
	case <-time.After(t):
		fatal(tb, msgAndArgs, "operation did not finish within %s", t.String())
	}
}
func NoErrorWithinT ( tb testing . TB , t time . Duration , f func ( ) error , msgAndArgs ... interface { } ) { tb . Helper ( ) errCh := make ( chan error ) go func ( ) { // This goro will leak if the timeout is exceeded, but it's okay because the // test is failing anyway errCh <- f ( ) } ( ) select { case err := <- errCh : if err != nil { fatal ( tb , msgAndArgs , " " , err . Error ( ) ) } case <- time . After ( t ) : fatal ( tb , msgAndArgs , " " , t . String ( ) ) } }
// NoErrorWithinT checks that 'f' finishes within time 't' and does not emit an
// error
NoErrorWithinT checks that f finishes within time t and does not emit an error