forked from quic-go/quic-go
use testing.B.Loop in all benchmark tests (#5285)
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -category=bloop -fix -test ./... was used as a starting point.
This commit is contained in:
@@ -31,8 +31,7 @@ func BenchmarkHandshake(b *testing.B) {
|
||||
tr := &quic.Transport{Conn: newUDPConnLocalhost(b)}
|
||||
defer tr.Close()
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
for b.Loop() {
|
||||
c, err := tr.Dial(context.Background(), ln.Addr(), tlsClientConfig, nil)
|
||||
require.NoError(b, err)
|
||||
serverConn := <-connChan
|
||||
@@ -68,8 +67,7 @@ func BenchmarkStreamChurn(b *testing.B) {
|
||||
}
|
||||
}()
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
for b.Loop() {
|
||||
str, err := conn.OpenStreamSync(context.Background())
|
||||
require.NoError(b, err)
|
||||
require.NoError(b, str.Close())
|
||||
|
||||
Reference in New Issue
Block a user