Skip to content

Commit

Permalink
Test podSecurityContext for auth and proxy deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
AuditeMarlow authored and github-actions committed Apr 26, 2024
1 parent 7e9ed7f commit e9f1028
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
29 changes: 29 additions & 0 deletions examples/chart/teleport-cluster/tests/auth_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,35 @@ tests:
- matchSnapshot:
path: spec.template.spec

- it: should set podSecurityContext when set in values
template: auth/deployment.yaml
values:
- ../.lint/pod-security-context.yaml
asserts:
- equal:
path: spec.template.spec.securityContext.fsGroup
value: 99
- equal:
path: spec.template.spec.securityContext.fsGroupChangePolicy
value: OnRootMismatch
- equal:
path: spec.template.spec.securityContext.runAsGroup
value: 99
- equal:
path: spec.template.spec.securityContext.runAsNonRoot
value: true
- equal:
path: spec.template.spec.securityContext.runAsUser
value: 99

- it: should not set podSecurityContext when is empty object (default value)
template: auth/deployment.yaml
values:
- ../.lint/pod-security-context-empty.yaml
asserts:
- isNull:
path: spec.template.spec.securityContext

- it: should set securityContext when set in values
template: auth/deployment.yaml
values:
Expand Down
29 changes: 29 additions & 0 deletions examples/chart/teleport-cluster/tests/proxy_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,35 @@ tests:
- matchSnapshot:
path: spec.template.spec

- it: should set podSecurityContext when set in values
template: proxy/deployment.yaml
values:
- ../.lint/pod-security-context.yaml
asserts:
- equal:
path: spec.template.spec.securityContext.fsGroup
value: 99
- equal:
path: spec.template.spec.securityContext.fsGroupChangePolicy
value: OnRootMismatch
- equal:
path: spec.template.spec.securityContext.runAsGroup
value: 99
- equal:
path: spec.template.spec.securityContext.runAsNonRoot
value: true
- equal:
path: spec.template.spec.securityContext.runAsUser
value: 99

- it: should not set podSecurityContext when is empty object (default value)
template: proxy/deployment.yaml
values:
- ../.lint/pod-security-context-empty.yaml
asserts:
- isNull:
path: spec.template.spec.securityContext

- it: should set securityContext when set in values
template: proxy/deployment.yaml
values:
Expand Down

0 comments on commit e9f1028

Please sign in to comment.