Skip to content

Commit a188b95

Browse files
committed
test: add t.Parallel and explicit error handling to warning tests
- Add t.Parallel() to TestHTTPResponseAdapterAddTrailerLogs and subtests - Add t.Parallel() to TestHttp2OriginWithHTTPSchemeWarning and subtests - Replace ignored error with explicit require.Error assertion for the https+http2Origin case where TLS cert loading fails as expected
1 parent 115cd8b commit a188b95

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

connection/quic_connection.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func newHTTPResponseAdapter(s *rpcquic.RequestServerStream, log *zerolog.Logger)
285285
}
286286

287287
func (hrw *httpResponseAdapter) AddTrailer(trailerName, trailerValue string) {
288-
// QUIC transport does not support trailers they are silently dropped.
288+
// QUIC transport does not support trailers; they are silently dropped.
289289
// This primarily affects gRPC, which encodes grpc-status in trailers.
290290
hrw.logger.Warn().Str("trailerName", trailerName).
291291
Msg("QUIC transport does not support trailers; trailer will be dropped. " +

connection/quic_connection_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,7 @@ func GenerateTLSConfig() *tls.Config {
993993
}
994994

995995
func TestHTTPResponseAdapterAddTrailerLogs(t *testing.T) {
996+
t.Parallel()
996997
tests := []struct {
997998
name string
998999
trailerName string
@@ -1004,6 +1005,7 @@ func TestHTTPResponseAdapterAddTrailerLogs(t *testing.T) {
10041005
}
10051006
for _, tt := range tests {
10061007
t.Run(tt.name, func(t *testing.T) {
1008+
t.Parallel()
10071009
var buf bytes.Buffer
10081010
log := zerolog.New(&buf)
10091011
adapter := newHTTPResponseAdapter(nil, &log)

ingress/origin_service_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func TestAddPortIfMissing(t *testing.T) {
3131
}
3232

3333
func TestHttp2OriginWithHTTPSchemeWarning(t *testing.T) {
34+
t.Parallel()
3435
tests := []struct {
3536
name string
3637
scheme string
@@ -44,12 +45,15 @@ func TestHttp2OriginWithHTTPSchemeWarning(t *testing.T) {
4445
}
4546
for _, tt := range tests {
4647
t.Run(tt.name, func(t *testing.T) {
48+
t.Parallel()
4749
var buf bytes.Buffer
4850
log := zerolog.New(&buf)
4951
svc := &httpService{url: &url.URL{Scheme: tt.scheme, Host: "localhost:8080"}}
50-
cfg := OriginRequestConfig{Http2Origin: tt.http2Origin}
51-
// start() will fail at TLS cert loading for https, that's expected for this test
52-
_ = svc.start(&log, nil, cfg)
52+
cfg := OriginRequestConfig{
53+
Http2Origin: tt.http2Origin,
54+
NoTLSVerify: true,
55+
}
56+
require.NoError(t, svc.start(&log, nil, cfg))
5357
if tt.wantWarning {
5458
require.Contains(t, buf.String(), "http2Origin is enabled")
5559
} else {

0 commit comments

Comments
 (0)