github.com/tumi8/quic-go@v0.37.4-tum/http3/http3_suite_test.go (about) 1 package http3 2 3 import ( 4 "os" 5 "strconv" 6 "testing" 7 "time" 8 9 "github.com/golang/mock/gomock" 10 11 . "github.com/onsi/ginkgo/v2" 12 . "github.com/onsi/gomega" 13 ) 14 15 func TestHttp3(t *testing.T) { 16 RegisterFailHandler(Fail) 17 RunSpecs(t, "HTTP/3 Suite") 18 } 19 20 var mockCtrl *gomock.Controller 21 22 var _ = BeforeEach(func() { 23 mockCtrl = gomock.NewController(GinkgoT()) 24 }) 25 26 var _ = AfterEach(func() { 27 mockCtrl.Finish() 28 }) 29 30 //nolint:unparam 31 func scaleDuration(t time.Duration) time.Duration { 32 scaleFactor := 1 33 if f, err := strconv.Atoi(os.Getenv("TIMESCALE_FACTOR")); err == nil { // parsing "" errors, so this works fine if the env is not set 34 scaleFactor = f 35 } 36 Expect(scaleFactor).ToNot(BeZero()) 37 return time.Duration(scaleFactor) * t 38 }