--- # yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json suite: pod - fields - serviceAccount templates: - common.yaml values: - ../_values/controllers_main_default_container.yaml tests: - it: default should pass documentSelector: path: $[?(@.kind == "Deployment")].metadata.name value: release-name asserts: - equal: path: spec.template.spec.serviceAccountName value: default - it: with serviceAccount identifier should pass set: controllers: main: serviceAccount: identifier: mySA3 serviceAccount: mySA3: {} documentSelector: path: $[?(@.kind == "Deployment")].metadata.name value: release-name asserts: - equal: path: spec.template.spec.serviceAccountName value: release-name - it: with non-existing serviceAccount identifier fail set: controllers: main: serviceAccount: identifier: mySA3 asserts: - failedTemplate: errorMessage: "No enabled ServiceAccount found with this identifier. (controller: 'main', identifier: 'mySA3')" - it: with serviceAccount name should pass set: controllers: main: serviceAccount: name: mySA3 documentSelector: path: $[?(@.kind == "Deployment")].metadata.name value: release-name asserts: - equal: path: spec.template.spec.serviceAccountName value: mySA3