aports/testing/grpcurl/update-tls-error-checks.patch
mio 6603010c0d testing/grpcurl: fix test with go 1.25
Fix tls test cases with go 1.25.

```
--- FAIL: TestBrokenTLS_ClientNotTrusted (0.01s)
    tls_settings_test.go:257: expecting TLS certificate error, got: remote error: tls: handshake failure
--- FAIL: TestBrokenTLS_RequireClientCertButNonePresented (0.01s)
    tls_settings_test.go:297: expecting TLS certificate error, got: remote error: tls: handshake failure
FAIL
FAIL	github.com/fullstorydev/grpcurl	20.482s
ok  	github.com/fullstorydev/grpcurl/cmd/grpcurl	0.010s
?   	github.com/fullstorydev/grpcurl/internal/testing	[no test files]
?   	github.com/fullstorydev/grpcurl/internal/testing/cmd/bankdemo	[no test files]
?   	github.com/fullstorydev/grpcurl/internal/testing/cmd/testserver	[no test files]
?   	github.com/fullstorydev/grpcurl/internal/testing/jsonpb_test_proto	[no test files]
FAIL
>>> ERROR: grpcurl: check failed
```
2025-09-05 05:57:38 +00:00

51 lines
2.0 KiB
Diff

Patch-Source: https://github.com/fullstorydev/grpcurl/pull/522
---
From 40f2159e71382a96a0a3f6828137dee937c84847 Mon Sep 17 00:00:00 2001
From: Mikel Olasagasti Uranga <mikel@olasagasti.info>
Date: Thu, 24 Jul 2025 22:36:31 +0200
Subject: [PATCH] test: Update TLS error checks for Go 1.25 compatibility
The error message for client certificate failures changed in Go 1.25.
Update tests to check for both the old ("bad certificate") and new
("handshake failure") error strings to support multiple Go versions.
Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
---
tls_settings_test.go | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tls_settings_test.go b/tls_settings_test.go
index b12a2514..ad8958f7 100644
--- a/tls_settings_test.go
+++ b/tls_settings_test.go
@@ -253,8 +253,12 @@ func TestBrokenTLS_ClientNotTrusted(t *testing.T) {
e.Close()
t.Fatal("expecting TLS failure setting up server and client")
}
- if !strings.Contains(err.Error(), "bad certificate") {
- t.Fatalf("expecting TLS certificate error, got: %v", err)
+ // Check for either the old error (Go <=1.24) or the new one (Go 1.25+)
+ // Go 1.24: "bad certificate"
+ // Go 1.25: "handshake failure"
+ errMsg := err.Error()
+ if !strings.Contains(errMsg, "bad certificate") && !strings.Contains(errMsg, "handshake failure") {
+ t.Fatalf("expecting a specific TLS certificate or handshake error, got: %v", err)
}
}
@@ -293,8 +297,12 @@ func TestBrokenTLS_RequireClientCertButNonePresented(t *testing.T) {
e.Close()
t.Fatal("expecting TLS failure setting up server and client")
}
- if !strings.Contains(err.Error(), "bad certificate") {
- t.Fatalf("expecting TLS certificate error, got: %v", err)
+ // Check for either the old error (Go <=1.24) or the new one (Go 1.25+)
+ // Go 1.24: "bad certificate"
+ // Go 1.25: "handshake failure"
+ errMsg := err.Error()
+ if !strings.Contains(errMsg, "bad certificate") && !strings.Contains(errMsg, "handshake failure") {
+ t.Fatalf("expecting a specific TLS certificate or handshake error, got: %v", err)
}
}