mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2025-12-23 06:15:47 +00:00
update unit test expectations for kube 1.35 libraries
This commit is contained in:
@@ -1749,7 +1749,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -1819,7 +1818,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -1883,7 +1881,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -1950,7 +1947,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -2033,7 +2029,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -2116,7 +2111,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -2201,7 +2195,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -2281,7 +2274,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-sso
|
||||
current-context: kind-context-sso
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-sso
|
||||
user:
|
||||
@@ -2400,7 +2392,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -2509,7 +2500,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -2586,7 +2576,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -2665,7 +2654,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -2742,7 +2730,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -2815,7 +2802,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -2895,7 +2881,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -2982,7 +2967,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3070,7 +3054,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3158,7 +3141,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3236,7 +3218,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3319,7 +3300,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3385,7 +3365,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3446,7 +3425,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3507,7 +3485,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3569,7 +3546,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3631,7 +3607,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3692,7 +3667,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3752,7 +3726,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
@@ -3818,7 +3791,6 @@ func TestGetKubeconfig(t *testing.T) {
|
||||
name: kind-context-pinniped
|
||||
current-context: kind-context-pinniped
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: kind-user-pinniped
|
||||
user:
|
||||
|
||||
@@ -130,9 +130,7 @@ func TestWhoami(t *testing.T) {
|
||||
{
|
||||
"kind": "WhoAmIRequest",
|
||||
"apiVersion": "identity.concierge.pinniped.dev/v1alpha1",
|
||||
"metadata": {
|
||||
"creationTimestamp": null
|
||||
},
|
||||
"metadata": {},
|
||||
"spec": {},
|
||||
"status": {
|
||||
"kubernetesUserInfo": {
|
||||
@@ -154,9 +152,7 @@ func TestWhoami(t *testing.T) {
|
||||
{
|
||||
"kind": "WhoAmIRequest",
|
||||
"apiVersion": "identity.concierge.tuna.io/v1alpha1",
|
||||
"metadata": {
|
||||
"creationTimestamp": null
|
||||
},
|
||||
"metadata": {},
|
||||
"spec": {},
|
||||
"status": {
|
||||
"kubernetesUserInfo": {
|
||||
@@ -177,8 +173,7 @@ func TestWhoami(t *testing.T) {
|
||||
wantStdout: here.Doc(`
|
||||
apiVersion: identity.concierge.pinniped.dev/v1alpha1
|
||||
kind: WhoAmIRequest
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
spec: {}
|
||||
status:
|
||||
kubernetesUserInfo:
|
||||
@@ -195,8 +190,7 @@ func TestWhoami(t *testing.T) {
|
||||
wantStdout: here.Doc(`
|
||||
apiVersion: identity.concierge.tuna.io/v1alpha1
|
||||
kind: WhoAmIRequest
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
spec: {}
|
||||
status:
|
||||
kubernetesUserInfo:
|
||||
|
||||
@@ -769,23 +769,23 @@ func TestImpersonator(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "header canonicalization future UID header", // no longer future as it exists in Kube v1.22
|
||||
name: "header canonicalization of UID header, starting in Kube v1.22",
|
||||
clientCert: newClientCert(t, ca, "test-username", []string{"test-group1", "test-group2"}),
|
||||
clientMutateHeaders: func(header http.Header) {
|
||||
header["imPerSonaTE-uid"] = []string{"007"}
|
||||
},
|
||||
wantError: `an error on the server ("Internal Server Error: \"/api/v1/namespaces\": requested [{UID 007 authentication.k8s.io/v1 }] without impersonating a user") has prevented the request from succeeding (get namespaces)`,
|
||||
wantError: `requested [{UID 007 authentication.k8s.io/v1 }] without impersonating a user`,
|
||||
wantAuthorizerAttributes: func(_credentialID string) []authorizer.AttributesRecord {
|
||||
return []authorizer.AttributesRecord{}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "UID header starting in Kube v1.22",
|
||||
name: "UID header, starting in Kube v1.22",
|
||||
clientCert: newClientCert(t, ca, "test-username", []string{"test-group1", "test-group2"}),
|
||||
clientMutateHeaders: func(header http.Header) {
|
||||
header["Impersonate-Uid"] = []string{"008"}
|
||||
},
|
||||
wantError: `an error on the server ("Internal Server Error: \"/api/v1/namespaces\": requested [{UID 008 authentication.k8s.io/v1 }] without impersonating a user") has prevented the request from succeeding (get namespaces)`,
|
||||
wantError: `requested [{UID 008 authentication.k8s.io/v1 }] without impersonating a user`,
|
||||
wantAuthorizerAttributes: func(_credentialID string) []authorizer.AttributesRecord {
|
||||
return []authorizer.AttributesRecord{}
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2022-2024 the Pinniped contributors. All Rights Reserved.
|
||||
// Copyright 2022-2025 the Pinniped contributors. All Rights Reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package clientsecretrequest
|
||||
@@ -161,7 +161,7 @@ func TestCreate(t *testing.T) {
|
||||
wantErrStatus: &metav1.Status{
|
||||
Status: metav1.StatusFailure,
|
||||
Message: `OIDCClientSecretRequest.clientsecret.supervisor.pinniped.dev "client.oauth.pinniped.dev-some-client-name" ` +
|
||||
`is invalid: dryRun: Unsupported value: []string{"stuff"}`,
|
||||
`is invalid: dryRun: Unsupported value: ["stuff"]`,
|
||||
Reason: metav1.StatusReasonInvalid,
|
||||
Code: http.StatusUnprocessableEntity,
|
||||
Details: &metav1.StatusDetails{
|
||||
@@ -170,7 +170,7 @@ func TestCreate(t *testing.T) {
|
||||
Name: "client.oauth.pinniped.dev-some-client-name",
|
||||
Causes: []metav1.StatusCause{{
|
||||
Type: "FieldValueNotSupported",
|
||||
Message: "Unsupported value: []string{\"stuff\"}",
|
||||
Message: `Unsupported value: ["stuff"]`,
|
||||
Field: "dryRun",
|
||||
}},
|
||||
},
|
||||
|
||||
@@ -597,7 +597,7 @@ func TestCreate(t *testing.T) {
|
||||
})
|
||||
|
||||
requireAPIError(t, response, err, apierrors.IsInvalid,
|
||||
`.pinniped.dev "request name" is invalid: dryRun: Unsupported value: []string{"some dry run flag"}`)
|
||||
`.pinniped.dev "request name" is invalid: dryRun: Unsupported value: ["some dry run flag"]`)
|
||||
})
|
||||
|
||||
it("CreateFailsWhenNamespaceIsNotEmpty", func() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved.
|
||||
// Copyright 2021-2025 the Pinniped contributors. All Rights Reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package whoamirequest
|
||||
@@ -92,7 +92,7 @@ func TestCreate(t *testing.T) {
|
||||
options: &metav1.CreateOptions{DryRun: []string{"stuff"}},
|
||||
},
|
||||
want: nil,
|
||||
wantErr: `SomeKind.identity.concierge.pinniped.dev "some-name" is invalid: dryRun: Unsupported value: []string{"stuff"}`,
|
||||
wantErr: `SomeKind.identity.concierge.pinniped.dev "some-name" is invalid: dryRun: Unsupported value: ["stuff"]`,
|
||||
},
|
||||
{
|
||||
name: "bad namespace",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved.
|
||||
// Copyright 2020-2025 the Pinniped contributors. All Rights Reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package conciergeclient
|
||||
@@ -229,9 +229,7 @@ func TestExchangeToken(t *testing.T) {
|
||||
`{
|
||||
"kind": "TokenCredentialRequest",
|
||||
"apiVersion": "login.concierge.pinniped.dev/v1alpha1",
|
||||
"metadata": {
|
||||
"creationTimestamp": null
|
||||
},
|
||||
"metadata": {},
|
||||
"spec": {
|
||||
"token": "test-token",
|
||||
"authenticator": {
|
||||
|
||||
Reference in New Issue
Block a user