Skip to content

Commit 07b54fe

Browse files
committed
feat: add platform access approval and rejection tests
1 parent 83d0a32 commit 07b54fe

File tree

6 files changed

+120
-0
lines changed

6 files changed

+120
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: chainsaw.kyverno.io/v1alpha1
2+
kind: Test
3+
metadata:
4+
name: platform-access-approval
5+
spec:
6+
description: |
7+
Verify that a User's registrationApproval starts as Pending and becomes Approved
8+
after creating a PlatformAccessApproval.
9+
steps:
10+
- name: approval-flow
11+
description: Create a User, confirm Pending, then approve and expect Approved
12+
try:
13+
- apply:
14+
file: resources/user-approval.yaml
15+
- wait:
16+
apiVersion: iam.miloapis.com/v1alpha1
17+
kind: User
18+
name: access-approval-test-user
19+
timeout: 2m
20+
for:
21+
condition:
22+
name: Ready
23+
value: 'True'
24+
- wait:
25+
apiVersion: iam.miloapis.com/v1alpha1
26+
kind: User
27+
name: access-approval-test-user
28+
timeout: 1m
29+
for:
30+
jsonPath:
31+
path: '{.status.registrationApproval}'
32+
value: Pending
33+
- apply:
34+
file: resources/approval.yaml
35+
- wait:
36+
apiVersion: iam.miloapis.com/v1alpha1
37+
kind: User
38+
name: access-approval-test-user
39+
timeout: 2m
40+
for:
41+
jsonPath:
42+
path: '{.status.registrationApproval}'
43+
value: Approved
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: iam.miloapis.com/v1alpha1
2+
kind: PlatformAccessApproval
3+
metadata:
4+
name: access-approval-for-test-user
5+
spec:
6+
subjectRef:
7+
userRef:
8+
name: access-approval-test-user
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: iam.miloapis.com/v1alpha1
2+
kind: User
3+
metadata:
4+
name: access-approval-test-user
5+
spec:
6+
7+
givenName: Approval
8+
familyName: User
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
apiVersion: chainsaw.kyverno.io/v1alpha1
2+
kind: Test
3+
metadata:
4+
name: platform-access-rejection
5+
spec:
6+
description: |
7+
Verify that a User's registrationApproval starts as Pending and becomes Rejected
8+
after creating a PlatformAccessRejection.
9+
steps:
10+
- name: rejection-flow
11+
description: Create a User, confirm Pending, then reject and expect Rejected
12+
try:
13+
- apply:
14+
file: resources/user-rejection.yaml
15+
- wait:
16+
apiVersion: iam.miloapis.com/v1alpha1
17+
kind: User
18+
name: access-rejection-test-user
19+
timeout: 2m
20+
for:
21+
condition:
22+
name: Ready
23+
value: 'True'
24+
- wait:
25+
apiVersion: iam.miloapis.com/v1alpha1
26+
kind: User
27+
name: access-rejection-test-user
28+
timeout: 1m
29+
for:
30+
jsonPath:
31+
path: '{.status.registrationApproval}'
32+
value: Pending
33+
- apply:
34+
file: resources/rejection.yaml
35+
- wait:
36+
apiVersion: iam.miloapis.com/v1alpha1
37+
kind: User
38+
name: access-rejection-test-user
39+
timeout: 2m
40+
for:
41+
jsonPath:
42+
path: '{.status.registrationApproval}'
43+
value: Rejected
44+
45+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: iam.miloapis.com/v1alpha1
2+
kind: PlatformAccessRejection
3+
metadata:
4+
name: access-rejection-for-test-user
5+
spec:
6+
subjectRef:
7+
name: access-rejection-test-user
8+
reason: Not eligible for platform access
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: iam.miloapis.com/v1alpha1
2+
kind: User
3+
metadata:
4+
name: access-rejection-test-user
5+
spec:
6+
7+
givenName: Rejection
8+
familyName: User

0 commit comments

Comments
 (0)