golang: 1.20.7 -> 1.21 (#6189)

https://tip.golang.org/doc/go1.21

This required some test updates:

* topdown/tokens_test: adjust for go1.21

   What was correct for 1.20 is correct for 1.21, so I've flipped the exception logic.

* plugins/rest/TestClientCert: adapt cert-related error string

* internal/prometheus/TestJSONSerialization: add new metrics

   There are new metrics!

Signed-off-by: Stephan Renatus <stephan@styra.com>
This commit is contained in:
Stephan Renatus
2023-08-29 15:26:09 +02:00
committed by GitHub
parent 9f895711b1
commit f8e1e4bf2d
4 changed files with 41 additions and 7 deletions
+11 -3
View File
@@ -1274,9 +1274,17 @@ func TestClientCert(t *testing.T) {
// Ensure the keys don't work anymore, make a new client as the url will have changed
client = newTestClient(t, &ts, certPath, keyPath)
_, err := client.Do(ctx, "GET", "test")
expectedErrMsg := "tls: bad certificate"
if err == nil || !strings.Contains(err.Error(), expectedErrMsg) {
t.Fatalf("Expected '%s' error but request succeeded", expectedErrMsg)
expectedErrMsg := func(s string) bool {
switch {
case strings.Contains(s, "tls: unknown certificate authority"):
case strings.Contains(s, "tls: bad certificate"):
default:
return false
}
return true
}
if err == nil || !expectedErrMsg(err.Error()) {
t.Fatalf("Unexpected error %v", err)
}
// Update the key files and try again..