charts/teleport-kube-agent/tests/updater_rolebinding_test.yaml
2023-09-09 15:54:27 +08:00

50 lines
1.2 KiB
YAML

suite: Updater Role
templates:
- updater/rolebinding.yaml
tests:
#
# Basic tests
#
- it: does not create a RoleBinding when updater.enabled is false (default)
asserts:
- hasDocuments:
count: 0
- it: creates a RoleBinding when updater.enabled is true
values:
- ../.lint/updater.yaml
asserts:
- containsDocument:
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
name: RELEASE-NAME-updater
namespace: NAMESPACE
- it: does not create a RoleBinding when updater.enabled is true but rbac creation is disabled
values:
- ../.lint/updater.yaml
set:
rbac:
create: false
asserts:
- hasDocuments:
count: 0
#
# Catch-all content test
#
- it: sets the correct rolebinding content
values:
- ../.lint/updater.yaml
asserts:
- equal:
path: roleRef
value:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: RELEASE-NAME-updater
- equal:
path: subjects
value:
- kind: ServiceAccount
name: RELEASE-NAME-updater
namespace: NAMESPACE