remove tests made redundant in Go 1.26.1 by https://github.com/golang/go/issues/77578

This commit is contained in:
Ryan Richard
2026-03-23 11:12:59 -07:00
parent 45f5cbd419
commit 6855ccba9d
2 changed files with 6 additions and 75 deletions
@@ -1,4 +1,4 @@
// Copyright 2020-2025 the Pinniped contributors. All Rights Reserved.
// Copyright 2020-2026 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package webhookcachefiller
@@ -1951,58 +1951,6 @@ func TestController(t *testing.T) {
wantNamesOfWebhookAuthenticatorsInCache: []string{},
wantSyncErr: testutil.WantExactErrorString(`error for WebhookAuthenticator test-name: cannot dial server: tls: failed to verify certificate: x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs`),
},
{
name: "validateConnection: IPv6 address without port or brackets: should succeed since IPv6 brackets are optional without port",
webhookAuthenticators: []runtime.Object{
&authenticationv1alpha1.WebhookAuthenticator{
ObjectMeta: metav1.ObjectMeta{
Name: "test-name",
},
Spec: authenticationv1alpha1.WebhookAuthenticatorSpec{
Endpoint: "https://0:0:0:0:0:0:0:1/some/fake/path",
TLS: &authenticationv1alpha1.TLSSpec{
CertificateAuthorityData: base64.StdEncoding.EncodeToString(caForLocalhostAs127001.Bundle()),
},
},
},
},
wantLogLines: []string{
`{"level":"info","timestamp":"2099-08-08T13:57:36.123456Z","logger":"webhookcachefiller-controller","caller":"webhookcachefiller/webhookcachefiller.go:<line>$webhookcachefiller.(*webhookCacheFillerController).syncIndividualWebhookAuthenticator","message":"invalid webhook authenticator","webhookAuthenticator":"test-name","endpoint":"https://0:0:0:0:0:0:0:1/some/fake/path","removedFromCache":false}`,
`{"level":"debug","timestamp":"2099-08-08T13:57:36.123456Z","logger":"webhookcachefiller-controller","caller":"webhookcachefiller/webhookcachefiller.go:<line>$webhookcachefiller.(*webhookCacheFillerController).updateStatus","message":"webhookauthenticator status successfully updated","webhookAuthenticator":"test-name","endpoint":"https://0:0:0:0:0:0:0:1/some/fake/path","phase":"Error"}`,
},
wantActions: func() []coretesting.Action {
updateStatusAction := coretesting.NewUpdateAction(webhookAuthenticatorGVR, "", &authenticationv1alpha1.WebhookAuthenticator{
ObjectMeta: metav1.ObjectMeta{
Name: "test-name",
},
Spec: authenticationv1alpha1.WebhookAuthenticatorSpec{
Endpoint: "https://0:0:0:0:0:0:0:1/some/fake/path",
TLS: &authenticationv1alpha1.TLSSpec{
CertificateAuthorityData: base64.StdEncoding.EncodeToString(caForLocalhostAs127001.Bundle()),
},
},
Status: authenticationv1alpha1.WebhookAuthenticatorStatus{
Conditions: conditionstestutil.Replace(
allHappyConditionsSuccess("https://0:0:0:0:0:0:0:1/some/fake/path", frozenMetav1Now, 0),
[]metav1.Condition{
sadWebhookConnectionValidWithMessage(frozenMetav1Now, 0, "cannot dial server: dial tcp [::1]:443: connect: connection refused"),
sadReadyCondition(frozenMetav1Now, 0),
unknownAuthenticatorValid(frozenMetav1Now, 0),
},
),
Phase: "Error",
},
})
updateStatusAction.Subresource = "status"
return []coretesting.Action{
coretesting.NewListAction(webhookAuthenticatorGVR, webhookAuthenticatorGVK, "", metav1.ListOptions{}),
coretesting.NewWatchAction(webhookAuthenticatorGVR, "", metav1.ListOptions{Watch: true}),
updateStatusAction,
}
},
wantSyncErr: testutil.WantExactErrorString(`error for WebhookAuthenticator test-name: cannot dial server: dial tcp [::1]:443: connect: connection refused`),
wantNamesOfWebhookAuthenticatorsInCache: []string{},
},
{
name: "updateStatus: called with matching original and updated conditions: will not make request to update conditions",
webhookAuthenticators: []runtime.Object{
+5 -22
View File
@@ -1,4 +1,4 @@
// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved.
// Copyright 2021-2026 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package endpointaddr
@@ -182,6 +182,8 @@ func TestParse(t *testing.T) {
},
} {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
got, err := Parse(tt.input, tt.defaultPort)
if tt.expectErr == "" {
assert.NoError(t, err)
@@ -307,29 +309,10 @@ func TestParseFromURL(t *testing.T) {
expect: HostPort{Host: "2001:db8::ffff", Port: 443},
expectEndpoint: "[2001:db8::ffff]:443",
},
{
name: "IPv6 without brackets and without port will create HostPort{}, which will add brackets when HostPort.Endpoint() is called",
input: "http://2001:db8::1234",
defaultPort: 443,
expect: HostPort{Host: "2001:db8::1234", Port: 443},
expectEndpoint: "[2001:db8::1234]:443",
},
{
name: "IPv6 without brackets and without port with path create HostPort{}, which will add brackets when HostPort.Endpoint() is called",
input: "https://0:0:0:0:0:0:0:1/some/fake/path",
defaultPort: 443,
expect: HostPort{Host: "0:0:0:0:0:0:0:1", Port: 443},
expectEndpoint: "[0:0:0:0:0:0:0:1]:443",
},
{
name: "IPv6 with mismatched leading bracket will err on bracket",
input: "https://[[::1]/some/fake/path",
defaultPort: 443,
expect: HostPort{Host: "::1", Port: 443},
expectEndpoint: "[::1]:443",
},
} {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
urlToProcess, err := url.Parse(tt.input)
require.NoError(t, err, "ParseFromURL expects a valid url.URL, parse errors here are not valuable")