-
Notifications
You must be signed in to change notification settings - Fork 27
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 #615 from rstudio/add-more-unittests-workbench
Add a few more unittests for rstudio-workbench
- Loading branch information
Showing
3 changed files
with
179 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,58 @@ | ||
suite: Workbench Ingress | ||
templates: | ||
- ingress.yaml | ||
tests: | ||
- it: should include the tls path if tls has values specified and ingress is enabled | ||
template: ingress.yaml | ||
set: | ||
ingress: | ||
enabled: true | ||
tls: | ||
- hosts: | ||
- "example.com" | ||
secretName: "example-tls" | ||
asserts: | ||
- exists: | ||
path: "spec.tls" | ||
- equal: | ||
path: "spec.tls[0].hosts[0]" | ||
value: "example.com" | ||
- it: should not include the tls path if tls has no values specified and ingress is enabled | ||
template: ingress.yaml | ||
set: | ||
ingress: | ||
enabled: true | ||
tls: [] | ||
asserts: | ||
- notExists: | ||
path: "spec.tls" | ||
- it: should include the tls path if tls has values specified and ingress is enabled | ||
template: ingress.yaml | ||
set: | ||
ingress: | ||
enabled: true | ||
tls: | ||
- secretName: chart-example-tls | ||
hosts: | ||
- chart-example.local | ||
asserts: | ||
- exists: | ||
path: "spec.tls" | ||
- it: should include the ingressClassName if defined and ingress is enabled | ||
template: ingress.yaml | ||
set: | ||
ingress: | ||
enabled: true | ||
ingressClassName: "alb" | ||
asserts: | ||
- equal: | ||
path: "spec.ingressClassName" | ||
value: "alb" | ||
- it: should not include the ingressClassName if it is not defined and ingress is enabled | ||
template: ingress.yaml | ||
set: | ||
ingress: | ||
enabled: true | ||
asserts: | ||
- notExists: | ||
path: "spec.ingressClassName" |
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,87 @@ | ||
suite: Workbench prometheus configuration | ||
templates: | ||
- configmap-general.yaml | ||
- configmap-graphite-exporter.yaml | ||
- configmap-prestart.yaml | ||
- configmap-secret.yaml | ||
- configmap-session.yaml | ||
- deployment.yaml | ||
- svc.yaml | ||
tests: | ||
- it: should ensure the specified metrics port is used in the service if prometheus is enabled and legacy is not true | ||
template: svc.yaml | ||
set: | ||
prometheus: | ||
enabled: true | ||
port: 8989 | ||
asserts: | ||
- equal: | ||
path: "spec.ports[1].name" | ||
value: "metrics" | ||
- equal: | ||
path: "spec.ports[1].port" | ||
value: 8989 | ||
- it: should ensure the legacy metrics port is used in the service if prometheus is enabled and legacy is true | ||
template: svc.yaml | ||
set: | ||
prometheus: | ||
enabled: true | ||
legacy: true | ||
port: 8989 | ||
asserts: | ||
- equal: | ||
path: "spec.ports[1].name" | ||
value: "metrics" | ||
- equal: | ||
path: "spec.ports[1].port" | ||
value: 9108 | ||
- it: should ensure the prometheus annotations are defined in the service, and that the graphite exporter checksum is non-existent | ||
template: deployment.yaml | ||
set: | ||
prometheus: | ||
enabled: true | ||
port: 8989 | ||
asserts: | ||
- isSubset: | ||
path: spec.template.metadata.annotations | ||
content: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/path: "/metrics" | ||
prometheus.io/port: "8989" | ||
- notExists: | ||
path: "spec.template.metadata.annotations.checksum/config-graphite" | ||
- it: should ensure the legacy prometheus annotations are defined in the service, and that the graphite exporter checksum exists | ||
template: deployment.yaml | ||
set: | ||
prometheus: | ||
enabled: true | ||
legacy: true | ||
port: 8989 | ||
asserts: | ||
- isSubset: | ||
path: spec.template.metadata.annotations | ||
content: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/path: "/metrics" | ||
prometheus.io/port: "9108" | ||
- exists: | ||
path: "spec.template.metadata.annotations.checksum/config-graphite" | ||
- it: should ensure the legacy metrics port is used and that the graphite exporter container exists | ||
template: deployment.yaml | ||
set: | ||
prometheus: | ||
enabled: true | ||
legacy: true | ||
port: 8989 | ||
prometheusExporter: | ||
enabled: true | ||
asserts: | ||
- equal: | ||
path: "spec.template.spec.containers[1].name" | ||
value: "exporter" | ||
- equal: | ||
path: "spec.template.spec.containers[1].ports[0].name" | ||
value: "metrics" | ||
- equal: | ||
path: "spec.template.spec.containers[1].ports[0].containerPort" | ||
value: 9108 |
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,34 @@ | ||
suite: Workbench Deployment | ||
templates: | ||
- configmap-general.yaml | ||
- configmap-prestart.yaml | ||
- configmap-secret.yaml | ||
- configmap-session.yaml | ||
- deployment.yaml | ||
tests: | ||
- it: should not specify the RollingUpdate configuration if the strategy type is not RollingUpdate | ||
template: deployment.yaml | ||
set: | ||
strategy: | ||
type: "Recreate" | ||
asserts: | ||
- notExists: | ||
path: "spec.strategy.rollingUpdate" | ||
- it: should specify the RollingUpdate configuration if the strategy type is RollingUpdate | ||
template: deployment.yaml | ||
set: | ||
strategy: | ||
type: "RollingUpdate" | ||
rollingUpdate: | ||
maxUnavailable: 1 | ||
maxSurge: "50%" | ||
asserts: | ||
- equal: | ||
path: "spec.strategy.type" | ||
value: "RollingUpdate" | ||
- equal: | ||
path: "spec.strategy.rollingUpdate.maxUnavailable" | ||
value: 1 | ||
- equal: | ||
path: "spec.strategy.rollingUpdate.maxSurge" | ||
value: "50%" |