-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore] add unittests to verify rendering of service account (#1545)
* [chore] add unittests to verify rendering of service account * fix test suite name
- Loading branch information
Showing
1 changed file
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
suite: splunk-otel-collector.serviceAccount | ||
values: | ||
- ./values/basic.yaml | ||
templates: | ||
- serviceAccount.yaml | ||
- deployment-cluster-receiver.yaml | ||
- configmap-cluster-receiver.yaml | ||
- daemonset.yaml | ||
- configmap-fluentd.yaml | ||
- configmap-agent.yaml | ||
release: | ||
name: test-release | ||
tests: | ||
- it: should render serviceaccount correctly | ||
set: | ||
image: | ||
imagePullSecrets: | ||
- secret1 | ||
- secret2 | ||
serviceAccount: | ||
create: true | ||
annotations: | ||
key1: value1 | ||
featureGates: | ||
explicitMountServiceAccountToken: true # automount should be false | ||
template: serviceAccount.yaml | ||
asserts: | ||
- isKind: | ||
of: ServiceAccount | ||
template: serviceAccount.yaml | ||
- equal: | ||
path: metadata.name | ||
value: "test-release-splunk-otel-collector" | ||
- equal: | ||
path: metadata.annotations | ||
value: | ||
key1: value1 | ||
- equal: | ||
path: automountServiceAccountToken | ||
value: false | ||
- equal: | ||
path: imagePullSecrets | ||
value: | ||
- name: secret1 | ||
- name: secret2 | ||
- it: should add default serviceAccountName to deployment and daemonset | ||
set: | ||
serviceAccount: | ||
create: true | ||
templates: | ||
- deployment-cluster-receiver.yaml | ||
- daemonset.yaml | ||
asserts: | ||
- equal: | ||
path: spec.template.spec.serviceAccountName | ||
value: "test-release-splunk-otel-collector" | ||
template: deployment-cluster-receiver.yaml | ||
- equal: | ||
path: spec.template.spec.serviceAccountName | ||
value: "test-release-splunk-otel-collector" | ||
template: daemonset.yaml | ||
- it: should not render serviceaccount | ||
set: | ||
serviceAccount: | ||
create: false | ||
template: serviceAccount.yaml | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: should set custom service account name correctly in serviceaccount, deployment and daemonset | ||
set: | ||
serviceAccount: | ||
create: true | ||
name: custom-service-account | ||
templates: | ||
- deployment-cluster-receiver.yaml | ||
- daemonset.yaml | ||
- serviceAccount.yaml | ||
asserts: | ||
- equal: | ||
path: spec.template.spec.serviceAccountName | ||
value: custom-service-account | ||
template: deployment-cluster-receiver.yaml | ||
- equal: | ||
path: spec.template.spec.serviceAccountName | ||
value: custom-service-account | ||
template: daemonset.yaml | ||
- equal: | ||
path: metadata.name | ||
value: custom-service-account | ||
template: serviceAccount.yaml | ||
- it: should set custom service account name correctly in deployment and daemonset with no serviceaccount | ||
set: | ||
serviceAccount: | ||
create: false | ||
name: custom-service-account | ||
templates: | ||
- deployment-cluster-receiver.yaml | ||
- daemonset.yaml | ||
- serviceAccount.yaml | ||
asserts: | ||
- equal: | ||
path: spec.template.spec.serviceAccountName | ||
value: custom-service-account | ||
template: deployment-cluster-receiver.yaml | ||
- equal: | ||
path: spec.template.spec.serviceAccountName | ||
value: custom-service-account | ||
template: daemonset.yaml | ||
- hasDocuments: | ||
count: 0 | ||
template: serviceAccount.yaml |