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