mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
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:
@@ -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..
|
||||
|
||||
Reference in New Issue
Block a user