|
| 1 | +suite: RBAC |
| 2 | +release: |
| 3 | + namespace: test-ns |
| 4 | + |
| 5 | +tests: |
| 6 | + - it: Role is namespace-scoped (not ClusterRole) |
| 7 | + template: templates/role.yaml |
| 8 | + asserts: |
| 9 | + - isKind: |
| 10 | + of: Role |
| 11 | + - equal: |
| 12 | + path: metadata.namespace |
| 13 | + value: test-ns |
| 14 | + |
| 15 | + - it: RoleBinding is namespace-scoped (not ClusterRoleBinding) |
| 16 | + template: templates/rolebinding.yaml |
| 17 | + asserts: |
| 18 | + - isKind: |
| 19 | + of: RoleBinding |
| 20 | + - equal: |
| 21 | + path: metadata.namespace |
| 22 | + value: test-ns |
| 23 | + |
| 24 | + - it: RoleBinding references Role not ClusterRole |
| 25 | + template: templates/rolebinding.yaml |
| 26 | + asserts: |
| 27 | + - equal: |
| 28 | + path: roleRef.kind |
| 29 | + value: Role |
| 30 | + |
| 31 | + - it: RoleBinding subject namespace matches release namespace |
| 32 | + template: templates/rolebinding.yaml |
| 33 | + asserts: |
| 34 | + - equal: |
| 35 | + path: subjects[0].namespace |
| 36 | + value: test-ns |
| 37 | + |
| 38 | + - it: Role grants required verbs on pods |
| 39 | + template: templates/role.yaml |
| 40 | + asserts: |
| 41 | + - contains: |
| 42 | + path: rules |
| 43 | + content: |
| 44 | + apiGroups: [""] |
| 45 | + resources: ["pods"] |
| 46 | + verbs: ["get", "list", "watch", "update", "patch"] |
| 47 | + |
| 48 | + - it: Role grants full CRUD on httproutes |
| 49 | + template: templates/role.yaml |
| 50 | + asserts: |
| 51 | + - contains: |
| 52 | + path: rules |
| 53 | + content: |
| 54 | + apiGroups: ["gateway.networking.k8s.io"] |
| 55 | + resources: ["httproutes"] |
| 56 | + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] |
| 57 | + |
| 58 | + - it: Role grants full CRUD on services and endpoints |
| 59 | + template: templates/role.yaml |
| 60 | + asserts: |
| 61 | + - contains: |
| 62 | + path: rules |
| 63 | + content: |
| 64 | + apiGroups: [""] |
| 65 | + resources: ["services", "endpoints"] |
| 66 | + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] |
0 commit comments