migrate the transport tests away from Ginkgo (#4783)

* migrate the transport tests away from Ginkgo

* simplify mock net.PacketConn implementation
This commit is contained in:
Marten Seemann
2024-12-23 14:47:44 +08:00
committed by GitHub
parent 848042c69b
commit b493c5d827
4 changed files with 410 additions and 426 deletions

View File

@@ -5,7 +5,6 @@ import (
"errors"
"io"
"os"
"strconv"
"time"
"github.com/quic-go/quic-go/internal/mocks"
@@ -18,18 +17,6 @@ import (
"go.uber.org/mock/gomock"
)
// in the tests for the stream deadlines we set a deadline
// and wait to make an assertion when Read / Write was unblocked
// on the CIs, the timing is a lot less precise, so scale every duration by this factor
func scaleDuration(t time.Duration) time.Duration {
scaleFactor := 1
if f, err := strconv.Atoi(os.Getenv("TIMESCALE_FACTOR")); err == nil { // parsing "" errors, so this works fine if the env is not set
scaleFactor = f
}
Expect(scaleFactor).ToNot(BeZero())
return time.Duration(scaleFactor) * t
}
var _ = Describe("Stream", func() {
const streamID protocol.StreamID = 1337