Skip to content

Commit 97e5bdc

Browse files
committed
Add RBAC tests in BATS
1 parent c572947 commit 97e5bdc

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

templates/tests/st2tests-pod.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ spec:
4848
key: password
4949
- name: ST2_VERSION
5050
value: "{{ .Chart.AppVersion }}"
51+
- name: ST2_RBAC_ENABLED
52+
value: "{{ .Values.st2.rbac.enabled }}"
5153
volumeMounts:
5254
- name: tools
5355
mountPath: /tools

tests/st2tests.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,14 @@ load "${BATS_HELPERS_DIR}/bats-file/load.bash"
7474
assert_line --partial '"foo" is not found'
7575
assert_failure
7676
}
77+
78+
@test 'RBAC is loaded and enabled' {
79+
if [ $ST2_RBAC_ENABLED != "true" ]; then
80+
skip "disabled in Helm values"
81+
fi
82+
83+
run st2 whoami
84+
assert_success
85+
assert_output --regexp 'RBAC:\s+ - Enabled: True'
86+
assert_line --partial 'Roles: system_admin'
87+
}

0 commit comments

Comments
 (0)