Skip to content

Commit 2d516f8

Browse files
authored
chore(controller_test): add OIDCtoken cases for SecurityPolicyIndexFunc (#1362)
**Description** Add missing OIDC exchange token cases to Test_backendSecurityPolicyIndexFunc. **Related Issues/PRs (if applicable)** This is a follow-up to #1313 where the missing tests were seen during fixing that issue. **Special notes for reviewers (if applicable)** n/a Signed-off-by: Tim Swanson <[email protected]>
1 parent 5774a37 commit 2d516f8

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

internal/controller/controller_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,32 @@ func Test_backendSecurityPolicyIndexFunc(t *testing.T) {
196196
},
197197
expKey: "some-secret8.ns",
198198
},
199+
{
200+
name: "AWS OIDC exchange token",
201+
backendSecurityPolicy: &aigv1a1.BackendSecurityPolicy{
202+
ObjectMeta: metav1.ObjectMeta{Name: "some-backend-security-policy-9", Namespace: "foo"},
203+
Spec: aigv1a1.BackendSecurityPolicySpec{
204+
Type: aigv1a1.BackendSecurityPolicyTypeAWSCredentials,
205+
AWSCredentials: &aigv1a1.BackendSecurityPolicyAWSCredentials{
206+
OIDCExchangeToken: &aigv1a1.AWSOIDCExchangeToken{},
207+
},
208+
},
209+
},
210+
expKey: "some-backend-security-policy-9.foo",
211+
},
212+
{
213+
name: "Azure OIDC exchange token",
214+
backendSecurityPolicy: &aigv1a1.BackendSecurityPolicy{
215+
ObjectMeta: metav1.ObjectMeta{Name: "some-backend-security-policy-10", Namespace: "foo"},
216+
Spec: aigv1a1.BackendSecurityPolicySpec{
217+
Type: aigv1a1.BackendSecurityPolicyTypeAzureCredentials,
218+
AzureCredentials: &aigv1a1.BackendSecurityPolicyAzureCredentials{
219+
OIDCExchangeToken: &aigv1a1.AzureOIDCExchangeToken{},
220+
},
221+
},
222+
},
223+
expKey: "some-backend-security-policy-10.foo",
224+
},
199225
} {
200226
t.Run(bsp.name, func(t *testing.T) {
201227
c := fake.NewClientBuilder().

0 commit comments

Comments
 (0)