-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from mbaldessari/tests
Add some tests
- Loading branch information
Showing
2 changed files
with
177 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
suite: Test golang-external-secrets cluster secret store | ||
templates: | ||
- templates/vault/golang-external-secrets-hub-secretstore.yaml | ||
release: | ||
name: release-test | ||
tests: | ||
- it: should output nothing if .Value.global.secretStore is not "vault" | ||
set: | ||
global: | ||
secretStore: | ||
backend: "kubernetes" | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
||
- it: should output things if the backend is not set (we assume vault as a default) | ||
set: | ||
global: | ||
secretStore: | ||
backend: null | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- containsDocument: | ||
kind: ClusterSecretStore | ||
apiVersion: external-secrets.io/v1beta1 | ||
name: vault-backend | ||
namespace: golang-external-secrets | ||
|
||
- it: should output things if the backend is set to vault | ||
set: | ||
global: | ||
secretStore: | ||
backend: "vault" | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- containsDocument: | ||
kind: ClusterSecretStore | ||
apiVersion: external-secrets.io/v1beta1 | ||
name: vault-backend | ||
namespace: golang-external-secrets | ||
|
||
- it: should set the vault server to the hubClusterDomain | ||
set: | ||
global: | ||
hubClusterDomain: foo.bar.baz | ||
asserts: | ||
- equal: | ||
path: spec.provider.vault.server | ||
value: "https://vault-vault.foo.bar.baz" | ||
|
||
- it: should set secretRef | ||
asserts: | ||
- equal: | ||
path: spec.provider.vault.auth.kubernetes.secretRef.name | ||
value: golang-external-secrets | ||
- equal: | ||
path: spec.provider.vault.auth.kubernetes.secretRef.namespace | ||
value: golang-external-secrets | ||
- equal: | ||
path: spec.provider.vault.auth.kubernetes.secretRef.key | ||
value: token | ||
|
||
- it: should not set the caProvider when disabled | ||
set: | ||
golangExternalSecrets: | ||
caProvider: | ||
enabled: false | ||
asserts: | ||
- notExists: | ||
path: spec.provider.vault.caProvider | ||
|
||
- it: should set the caProvider to the hostCluster when on the hub | ||
set: | ||
clusterGroup: | ||
isHubCluster: true | ||
golangExternalSecrets: | ||
caProvider: | ||
hostCluster: | ||
name: foo-bar-configmap | ||
key: foo-key | ||
namespace: foo | ||
asserts: | ||
- equal: | ||
path: spec.provider.vault.caProvider.type | ||
value: ConfigMap | ||
- equal: | ||
path: spec.provider.vault.caProvider.name | ||
value: foo-bar-configmap | ||
- equal: | ||
path: spec.provider.vault.caProvider.key | ||
value: foo-key | ||
- equal: | ||
path: spec.provider.vault.caProvider.namespace | ||
value: foo | ||
|
||
- it: should set the caProvider to the clientCluster when not on the hub | ||
set: | ||
clusterGroup: | ||
isHubCluster: false | ||
golangExternalSecrets: | ||
caProvider: | ||
clientCluster: | ||
name: foo-bar-configmap | ||
key: foo-key | ||
namespace: foo | ||
asserts: | ||
- equal: | ||
path: spec.provider.vault.caProvider.type | ||
value: Secret | ||
- equal: | ||
path: spec.provider.vault.caProvider.name | ||
value: foo-bar-configmap | ||
- equal: | ||
path: spec.provider.vault.caProvider.key | ||
value: foo-key | ||
- equal: | ||
path: spec.provider.vault.caProvider.namespace | ||
value: foo | ||
|
||
- it: should set the kubernetes auth when on the hub | ||
set: | ||
clusterGroup: | ||
isHubCluster: true | ||
golangExternalSecrets: | ||
rbac: | ||
rolename: "hub-rolename" | ||
vault: | ||
mountPath: "hub-mount" | ||
asserts: | ||
- equal: | ||
path: spec.provider.vault.auth.kubernetes.mountPath | ||
value: hub-mount | ||
- equal: | ||
path: spec.provider.vault.auth.kubernetes.role | ||
value: hub-rolename | ||
|
||
- it: should set the kubernetes auth when not on the hub | ||
set: | ||
global: | ||
clusterDomain: foo.bar | ||
clusterGroup: | ||
isHubCluster: false | ||
asserts: | ||
- equal: | ||
path: spec.provider.vault.auth.kubernetes.mountPath | ||
value: foo.bar | ||
- equal: | ||
path: spec.provider.vault.auth.kubernetes.role | ||
value: foo.bar-role |