-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[super-agent] Add tests to the pre-install job (#1484)
Co-authored-by: Paolo Gallina <paologallina1992@gmail.com>
- Loading branch information
1 parent
77ae959
commit 3a14768
Showing
14 changed files
with
126 additions
and
48 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
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
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
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
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
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
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
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
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
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
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
69 changes: 69 additions & 0 deletions
69
charts/super-agent/charts/super-agent-deployment/tests/preinstall_job_test.yaml
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,69 @@ | ||
suite: pre-install job template | ||
templates: | ||
- templates/preinstall-job-register-system-identity.yaml | ||
release: | ||
name: my-release | ||
namespace: my-namespace | ||
set: | ||
cluster: test | ||
licenseKey: test | ||
tests: | ||
- it: by default it fails with missing values | ||
asserts: | ||
- failedTemplate: | ||
errorMessage: You must specify a userKey or a customUserKeySecretName containing it | ||
|
||
- it: if userKey is set, it should fail with missing organization id | ||
set: | ||
userKey: test | ||
asserts: | ||
- failedTemplate: | ||
errorMessage: .config.opamp.auth.organizationId is required | ||
|
||
- it: if organizationId is set, it should fail with missing userKey | ||
set: | ||
config: | ||
opamp: | ||
auth: | ||
organizationId: test | ||
asserts: | ||
- failedTemplate: | ||
errorMessage: You must specify a userKey or a customUserKeySecretName containing it | ||
|
||
- it: with everything set, the job should template correctly. | ||
set: | ||
userKey: test | ||
config: | ||
opamp: | ||
auth: | ||
organizationId: test | ||
asserts: | ||
- hasDocuments: | ||
count: 5 # Secret, job, and 3 RBAC manifests | ||
- documentIndex: 1 | ||
isNotNullOrEmpty: | ||
path: spec.template.spec.containers[0].args | ||
|
||
- it: with a custom secret for userKey, the secret should not be created. | ||
set: | ||
customUserKeySecretName: test-secret | ||
customUserKeySecretKey: test-key | ||
config: | ||
opamp: | ||
auth: | ||
organizationId: test | ||
asserts: | ||
- hasDocuments: | ||
count: 4 # With everything rendered it should be 5 | ||
- documentIndex: 0 | ||
isNotNullOrEmpty: | ||
path: spec.template.spec.containers[0].args | ||
- documentIndex: 0 | ||
contains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: USER_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: test-secret | ||
key: test-key |
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
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