diff --git a/ci/rstudio-workbench/tests/ingress_test.yaml b/ci/rstudio-workbench/tests/ingress_test.yaml new file mode 100644 index 00000000..ad7f878d --- /dev/null +++ b/ci/rstudio-workbench/tests/ingress_test.yaml @@ -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" diff --git a/ci/rstudio-workbench/tests/prometheus_test.yaml b/ci/rstudio-workbench/tests/prometheus_test.yaml new file mode 100644 index 00000000..4bae9f00 --- /dev/null +++ b/ci/rstudio-workbench/tests/prometheus_test.yaml @@ -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 diff --git a/ci/rstudio-workbench/tests/update_strategy_test.yaml b/ci/rstudio-workbench/tests/update_strategy_test.yaml new file mode 100644 index 00000000..d864113b --- /dev/null +++ b/ci/rstudio-workbench/tests/update_strategy_test.yaml @@ -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%"