Skip to content

Commit

Permalink
Merge pull request #109102 from liggitt/darwin-tls
Browse files Browse the repository at this point in the history
Tolerate additional error messages in TLS unit tests

Kubernetes-commit: 6358d36fbfb1a899de227bd053279ad258bddab3
  • Loading branch information
k8s-publishing-bot committed Mar 30, 2022
2 parents 00f0711 + 53a85ef commit 6550efd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/util/proxy/dial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"net/http/httptest"
"net/url"
"reflect"
"strings"
"regexp"
"testing"

"k8s.io/apimachinery/pkg/util/diff"
Expand Down Expand Up @@ -56,7 +56,7 @@ func TestDialURL(t *testing.T) {
},
"secure, no roots": {
TLSConfig: &tls.Config{InsecureSkipVerify: false},
ExpectError: "unknown authority",
ExpectError: "unknown authority|not trusted",
},
"secure with roots": {
TLSConfig: &tls.Config{InsecureSkipVerify: false, RootCAs: roots},
Expand All @@ -76,7 +76,7 @@ func TestDialURL(t *testing.T) {
"secure, no roots, custom dial": {
TLSConfig: &tls.Config{InsecureSkipVerify: false},
Dial: d.DialContext,
ExpectError: "unknown authority",
ExpectError: "unknown authority|not trusted",
},
"secure with roots, custom dial": {
TLSConfig: &tls.Config{InsecureSkipVerify: false, RootCAs: roots},
Expand Down Expand Up @@ -154,7 +154,7 @@ func TestDialURL(t *testing.T) {
if tc.ExpectError == "" {
t.Errorf("%s: expected no error, got %q", k, err.Error())
}
if !strings.Contains(err.Error(), tc.ExpectError) {
if tc.ExpectError != "" && !regexp.MustCompile(tc.ExpectError).MatchString(err.Error()) {
t.Errorf("%s: expected error containing %q, got %q", k, tc.ExpectError, err.Error())
}
return
Expand Down

0 comments on commit 6550efd

Please sign in to comment.