MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / LongRunningTest

Function LongRunningTest

base/util_testing.go:878–893  ·  view source on GitHub ↗

LongRunningTest skips the test if running in -short mode, and logs if the test completed quickly under other circumstances.

(t *testing.T)

Source from the content-addressed store, hash-verified

876
877// LongRunningTest skips the test if running in -short mode, and logs if the test completed quickly under other circumstances.
878func LongRunningTest(t *testing.T) {
879 const (
880 shortTestThreshold = time.Second
881 )
882 if testing.Short() {
883 t.Skip("skipping long running test in short mode")
884 return
885 }
886 start := time.Now()
887 t.Cleanup(func() {
888 testDuration := time.Since(start)
889 if !t.Failed() && !t.Skipped() && testDuration < shortTestThreshold {
890 t.Logf("TEST: %q was marked as long running, but finished in %v (less than %v) - consider removing LongRunningTest", t.Name(), testDuration, shortTestThreshold)
891 }
892 })
893}
894
895func AssertTimeGreaterThan(t *testing.T, e1, e2 time.Time, msgAndArgs ...interface{}) bool {
896 return AssertTimestampGreaterThan(t, e1.UnixNano(), e2.UnixNano(), msgAndArgs...)

Calls 3

NameMethod · 0.65
SinceMethod · 0.45
LogfMethod · 0.45