-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Zadkiel AHARONIAN <[email protected]>
- Loading branch information
1 parent
474201b
commit 98367dd
Showing
15 changed files
with
2,149 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,71 @@ | ||
suite: AlertmanagerConfig | ||
|
||
templates: | ||
- alertmanagerconfig.yaml | ||
|
||
tests: | ||
- it: does not yield AlertmanagerConfig if alertmanagerConfig.enabled is false | ||
set: | ||
alertmanagerConfig: | ||
enabled: false | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
||
- it: does not yield AlertmanagerConfig if API version is not available | ||
set: | ||
alertmanagerConfig: | ||
enabled: true | ||
capabilities: | ||
apiVersions: | ||
- apps/v1 | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
||
- it: yields AlertmanagerConfig if enabled and API version is available | ||
set: | ||
alertmanagerConfig: | ||
enabled: true | ||
spec: | ||
route: | ||
groupBy: ['alertname'] | ||
groupInterval: 5m | ||
groupWait: 30s | ||
repeatInterval: 1h | ||
receivers: | ||
- name: 'team-X-mails' | ||
emailConfigs: | ||
- to: '[email protected]' | ||
inhibitRules: | ||
- sourceMatch: | ||
severity: warning | ||
targetMatch: | ||
severity: critical | ||
equal: ['alertname', 'team'] | ||
capabilities: | ||
apiVersions: | ||
- monitoring.coreos.com/v1alpha1 | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: AlertmanagerConfig | ||
|
||
- it: includes additional labels when defined in values | ||
set: | ||
alertmanagerConfig: | ||
enabled: true | ||
selectionLabels: | ||
foo: bar | ||
test: ing | ||
capabilities: | ||
apiVersions: | ||
- monitoring.coreos.com/v1alpha1 | ||
asserts: | ||
- equal: | ||
path: metadata.labels.foo | ||
value: bar | ||
- equal: | ||
path: metadata.labels.test | ||
value: ing |
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,93 @@ | ||
suite: Backup | ||
|
||
templates: | ||
- backup.yaml | ||
|
||
tests: | ||
- it: does not yield Backup resource if backup.enabled is false | ||
set: | ||
backup: | ||
enabled: false | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
||
- it: yields Backup resource if backup.enabled is true | ||
set: | ||
backup: | ||
enabled: true | ||
namespace: my-namespace | ||
storageLocation: my-storage-location | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: Backup | ||
|
||
- it: includes correct metadata name | ||
set: | ||
backup: | ||
enabled: true | ||
namespace: my-namespace | ||
storageLocation: my-storage-location | ||
applicationName: my-app | ||
asserts: | ||
- equal: | ||
path: metadata.name | ||
value: my-app-backup | ||
|
||
- it: includes correct namespace | ||
set: | ||
backup: | ||
enabled: true | ||
namespace: my-namespace | ||
storageLocation: my-storage-location | ||
asserts: | ||
- equal: | ||
path: metadata.namespace | ||
value: my-namespace | ||
|
||
- it: uses default values for optional fields | ||
set: | ||
backup: | ||
enabled: true | ||
namespace: my-namespace | ||
storageLocation: my-storage-location | ||
asserts: | ||
- equal: | ||
path: spec.defaultVolumesToRestic | ||
value: true | ||
- equal: | ||
path: spec.snapshotVolumes | ||
value: true | ||
- equal: | ||
path: spec.ttl | ||
value: "1h0m0s" | ||
|
||
- it: includes includedResources when defined | ||
set: | ||
backup: | ||
enabled: true | ||
includedResources: | ||
- deployments | ||
- services | ||
asserts: | ||
- equal: | ||
path: spec.includedResources | ||
value: | ||
- deployments | ||
- services | ||
|
||
- it: includes excludedResources when defined | ||
set: | ||
backup: | ||
enabled: true | ||
excludedResources: | ||
- secrets | ||
- configmaps | ||
asserts: | ||
- equal: | ||
path: spec.excludedResources | ||
value: | ||
- secrets | ||
- configmaps |
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,160 @@ | ||
suite: Certificate | ||
|
||
templates: | ||
- certificate.yaml | ||
|
||
tests: | ||
- it: does not yield Certificate resource if certificate.enabled is false | ||
set: | ||
certificate: | ||
enabled: false | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
||
- it: does not yield Certificate resource if cert-manager API version is not available | ||
set: | ||
certificate: | ||
enabled: true | ||
capabilities: | ||
apiVersions: | ||
- apps/v1 | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
||
- it: yields Certificate resource if enabled and API version is available | ||
set: | ||
certificate: | ||
enabled: true | ||
secretName: my-secret | ||
duration: 2160h | ||
renewBefore: 360h | ||
subject: | ||
organizations: | ||
- MyOrg | ||
commonName: mydomain.com | ||
usages: | ||
- digital signature | ||
- key encipherment | ||
dnsNames: | ||
- mydomain.com | ||
- www.mydomain.com | ||
issuerRef: | ||
name: my-issuer | ||
kind: Issuer | ||
capabilities: | ||
apiVersions: | ||
- cert-manager.io/v1 | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: Certificate | ||
|
||
- it: includes additional labels when defined | ||
set: | ||
certificate: | ||
enabled: true | ||
additionalLabels: | ||
foo: bar | ||
test: ing | ||
capabilities: | ||
apiVersions: | ||
- cert-manager.io/v1 | ||
asserts: | ||
- equal: | ||
path: metadata.labels.foo | ||
value: bar | ||
- equal: | ||
path: metadata.labels.test | ||
value: ing | ||
|
||
- it: includes annotations when defined | ||
set: | ||
certificate: | ||
enabled: true | ||
annotations: | ||
foo: bar | ||
test: ing | ||
capabilities: | ||
apiVersions: | ||
- cert-manager.io/v1 | ||
asserts: | ||
- equal: | ||
path: metadata.annotations.foo | ||
value: bar | ||
- equal: | ||
path: metadata.annotations.test | ||
value: ing | ||
|
||
- it: does not include annotations if none are defined | ||
set: | ||
certificate: | ||
enabled: true | ||
annotations: {} | ||
capabilities: | ||
apiVersions: | ||
- cert-manager.io/v1 | ||
asserts: | ||
- notExists: | ||
path: metadata.annotations | ||
|
||
- it: includes issuer reference details | ||
set: | ||
certificate: | ||
enabled: true | ||
issuerRef: | ||
name: my-issuer | ||
kind: Issuer | ||
group: cert-manager.io | ||
capabilities: | ||
apiVersions: | ||
- cert-manager.io/v1 | ||
asserts: | ||
- equal: | ||
path: spec.issuerRef.name | ||
value: my-issuer | ||
- equal: | ||
path: spec.issuerRef.kind | ||
value: Issuer | ||
- equal: | ||
path: spec.issuerRef.group | ||
value: cert-manager.io | ||
|
||
- it: does not include keystores if not enabled | ||
set: | ||
certificate: | ||
enabled: true | ||
keystores: | ||
enabled: false | ||
capabilities: | ||
apiVersions: | ||
- cert-manager.io/v1 | ||
asserts: | ||
- notExists: | ||
path: spec.keystores | ||
|
||
- it: includes keystores if enabled | ||
set: | ||
certificate: | ||
enabled: true | ||
keystores: | ||
enabled: true | ||
jks: | ||
create: true | ||
key: my-jks-key | ||
name: my-jks-name | ||
capabilities: | ||
apiVersions: | ||
- cert-manager.io/v1 | ||
asserts: | ||
- equal: | ||
path: spec.keystores.jks.create | ||
value: true | ||
- equal: | ||
path: spec.keystores.jks.passwordSecretRef.key | ||
value: my-jks-key | ||
- equal: | ||
path: spec.keystores.jks.passwordSecretRef.name | ||
value: my-jks-name |
Oops, something went wrong.