add test for the service account

This commit is contained in:
Nikola Jokic 2026-02-05 16:50:55 +01:00
parent 3616911adb
commit a20374c027
No known key found for this signature in database
GPG Key ID: 419BB425B0E501B0
1 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,46 @@
suite: "Controller serviceAccount.create toggle"
templates:
- serviceaccount.yaml
- deployment.yaml
tests:
- it: should create ServiceAccount and use it in Deployment when create is true
set:
controller:
manager:
container:
image: "ghcr.io/actions/gha-runner-scale-set-controller:latest"
serviceAccount:
create: true
name: ""
release:
name: "test-name"
namespace: "test-namespace"
asserts:
- hasDocuments:
count: 1
template: serviceaccount.yaml
- equal:
path: spec.template.spec.serviceAccountName
value: "test-name-gha-rs-controller"
template: deployment.yaml
- it: should not create ServiceAccount and use provided name in Deployment when create is false
set:
controller:
manager:
container:
image: "ghcr.io/actions/gha-runner-scale-set-controller:latest"
serviceAccount:
create: false
name: "existing-sa"
release:
name: "test-name"
namespace: "test-namespace"
asserts:
- hasDocuments:
count: 0
template: serviceaccount.yaml
- equal:
path: spec.template.spec.serviceAccountName
value: "existing-sa"
template: deployment.yaml