From 6444d0f75d3df53927cd1968b57f820bf2ef8cc4 Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Wed, 20 Nov 2024 15:01:43 -0500 Subject: [PATCH 01/12] Rename the test suite to better match what it will be doing --- .../tests/{update_strategy_test.yaml => deployment_test.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ci/rstudio-workbench/tests/{update_strategy_test.yaml => deployment_test.yaml} (100%) diff --git a/ci/rstudio-workbench/tests/update_strategy_test.yaml b/ci/rstudio-workbench/tests/deployment_test.yaml similarity index 100% rename from ci/rstudio-workbench/tests/update_strategy_test.yaml rename to ci/rstudio-workbench/tests/deployment_test.yaml From 074635f0fde95bdd2115a498b1f8f7d9dd7da0c6 Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Thu, 21 Nov 2024 09:26:30 -0500 Subject: [PATCH 02/12] Start adding tests for the rstudio-workbench.containers definition in _helpers.tpl --- .../tests/deployment_test.yaml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ci/rstudio-workbench/tests/deployment_test.yaml b/ci/rstudio-workbench/tests/deployment_test.yaml index d864113b..ac42a67c 100644 --- a/ci/rstudio-workbench/tests/deployment_test.yaml +++ b/ci/rstudio-workbench/tests/deployment_test.yaml @@ -32,3 +32,32 @@ tests: - equal: path: "spec.strategy.rollingUpdate.maxSurge" value: "50%" + - it: should specify the diagnostic env vars if diagnostics is enabled + template: deployment.yaml + set: + diagnostics: + enabled: true + directory: "/var/log/rstudio-workbench" + asserts: + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name=="DIAGNOSTIC_DIR")].value' + value: "/var/log/rstudio-workbench" + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name=="DIAGNOSTIC_ENABLE")].value' + value: "true" + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name=="DIAGNOSTIC_ONLY")].value' + value: "true" + - it: should not specify the diagnostic env vars if diagnostics is not enabled + template: deployment.yaml + set: + diagnostics: + enabled: false + directory: "/var/log/rstudio-workbench" + asserts: + - notExists: + path: 'spec.template.spec.containers[0].env[?(@.name=="DIAGNOSTIC_DIR")]' + - notExists: + path: 'spec.template.spec.containers[0].env[?(@.name=="DIAGNOSTIC_ENABLE")]' + - notExists: + path: 'spec.template.spec.containers[0].env[?(@.name=="DIAGNOSTIC_ONLY")]' From 05abe0cbe5f95876cb998b9b5d26a4b5441c7c1f Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Thu, 21 Nov 2024 10:22:07 -0500 Subject: [PATCH 03/12] Add tests for launcher.kubernetesHealthCheck.enabled --- .../tests/deployment_test.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ci/rstudio-workbench/tests/deployment_test.yaml b/ci/rstudio-workbench/tests/deployment_test.yaml index ac42a67c..ee3480af 100644 --- a/ci/rstudio-workbench/tests/deployment_test.yaml +++ b/ci/rstudio-workbench/tests/deployment_test.yaml @@ -61,3 +61,26 @@ tests: path: 'spec.template.spec.containers[0].env[?(@.name=="DIAGNOSTIC_ENABLE")]' - notExists: path: 'spec.template.spec.containers[0].env[?(@.name=="DIAGNOSTIC_ONLY")]' + - it: should set the RSTUDIO_LAUNCHER_STARTUP_HEALTHCHECK_ARGS env var if launcher.kubernetesHealthCheck.enabled is true + template: deployment.yaml + set: + launcher: + kubernetesHealthCheck: + enabled: true + extraCurlArgs: ["-fsSL", "-k"] + asserts: + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSTUDIO_LAUNCHER_STARTUP_HEALTH_CHECK_ARGS")].value' + value: "-fsSL -k" + - notExists: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSTUDIO_LAUNCHER_STARTUP_HEALTH_CHECK")]' + - it: should set the RSTUDIO_LAUNCHER_STARTUP_HEALTH_CHECK to disabled if launcher.kubernetesHealthCheck.enabled is false + template: deployment.yaml + set: + launcher: + kubernetesHealthCheck: + enabled: false + asserts: + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSTUDIO_LAUNCHER_STARTUP_HEALTH_CHECK")].value' + value: "disabled" From de893f2f0d87a502e948ce477491f4f52832fd67 Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Thu, 21 Nov 2024 10:29:29 -0500 Subject: [PATCH 04/12] Add tests for testuser creation --- .../tests/deployment_test.yaml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/ci/rstudio-workbench/tests/deployment_test.yaml b/ci/rstudio-workbench/tests/deployment_test.yaml index ee3480af..da6c05c6 100644 --- a/ci/rstudio-workbench/tests/deployment_test.yaml +++ b/ci/rstudio-workbench/tests/deployment_test.yaml @@ -84,3 +84,35 @@ tests: - equal: path: 'spec.template.spec.containers[0].env[?(@.name=="RSTUDIO_LAUNCHER_STARTUP_HEALTH_CHECK")].value' value: "disabled" + - it: should set the ENV vars for user creation if userCreate is true + template: deployment.yaml + set: + userCreate: true + userName: "testuser" + userPassword: "testpassword" + userUid: 1000 + asserts: + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_TESTUSER")].value' + value: "testuser" + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_TESTUSER_PASSWD")].value' + value: "testpassword" + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_TESTUSER_UID")].value' + value: "1000" + - it: should set the RSW_TESTUSER ENV var to an empty string if userCreate is false + template: deployment.yaml + set: + userCreate: false + userName: "testuser" + userPassword: "testpassword" + userUid: 1000 + asserts: + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_TESTUSER")].value' + value: "" + - notExists: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_TESTUSER_PASSWD")]' + - notExists: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_TESTUSER_UID")]' From b96c7a3a246a2d9c6dbd7a6226b259b30a483548 Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Thu, 21 Nov 2024 10:40:23 -0500 Subject: [PATCH 05/12] Add tests for when we set RSW_LOAD_BALANCING --- .../tests/deployment_test.yaml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ci/rstudio-workbench/tests/deployment_test.yaml b/ci/rstudio-workbench/tests/deployment_test.yaml index da6c05c6..1f6a9193 100644 --- a/ci/rstudio-workbench/tests/deployment_test.yaml +++ b/ci/rstudio-workbench/tests/deployment_test.yaml @@ -116,3 +116,28 @@ tests: path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_TESTUSER_PASSWD")]' - notExists: path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_TESTUSER_UID")]' + - it: should set the RSW_LOAD_BALANCING env var to true if replicas > 1 + template: deployment.yaml + set: + replicas: 2 + asserts: + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_LOAD_BALANCING")].value' + value: "true" + - it: should not set the RSW_LOAD_BALANCING env var replicas = 1 + template: deployment.yaml + set: + replicas: 1 + asserts: + - notExists: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_LOAD_BALANCING")]' + - it: should set the RSW_LOAD_BALANCING env var to true if loadBalancer.forceEnabled is true even if replicas = 1 + template: deployment.yaml + set: + replicas: 1 + loadBalancer: + forceEnabled: true + asserts: + - equal: + path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_LOAD_BALANCING")].value' + value: "true" From 8f9c6841b823798a94bd17bfccc9ab74f620789a Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Thu, 21 Nov 2024 10:50:15 -0500 Subject: [PATCH 06/12] Add another prometheus check I found in _helpers.tpl --- ci/rstudio-workbench/tests/prometheus_test.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ci/rstudio-workbench/tests/prometheus_test.yaml b/ci/rstudio-workbench/tests/prometheus_test.yaml index 4bae9f00..bb211e67 100644 --- a/ci/rstudio-workbench/tests/prometheus_test.yaml +++ b/ci/rstudio-workbench/tests/prometheus_test.yaml @@ -85,3 +85,20 @@ tests: - equal: path: "spec.template.spec.containers[1].ports[0].containerPort" value: 9108 + - it: should ensure the metrics port is used in the rstudio container if prometheus is enabled and legacy is not true + template: deployment.yaml + set: + prometheus: + enabled: true + legacy: false + port: 8989 + asserts: + - equal: + path: "spec.template.spec.containers[0].name" + value: "rstudio" + - equal: + path: "spec.template.spec.containers[0].ports[1].name" + value: "metrics" + - equal: + path: "spec.template.spec.containers[0].ports[1].containerPort" + value: 8989 From d7442fff6e6bf6411caf1cd36865ae4514b975c7 Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Thu, 21 Nov 2024 15:54:33 -0500 Subject: [PATCH 07/12] Add a couple of tests for shared storage mounts/volumes --- .../tests/deployment_test.yaml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ci/rstudio-workbench/tests/deployment_test.yaml b/ci/rstudio-workbench/tests/deployment_test.yaml index 1f6a9193..61c66243 100644 --- a/ci/rstudio-workbench/tests/deployment_test.yaml +++ b/ci/rstudio-workbench/tests/deployment_test.yaml @@ -141,3 +141,29 @@ tests: - equal: path: 'spec.template.spec.containers[0].env[?(@.name=="RSW_LOAD_BALANCING")].value' value: "true" + - it: should specify a volumeMount and a volume for sharedStorage if sharedStorage.create is true + template: deployment.yaml + set: + sharedStorage: + create: true + path: "/mnt/shared" + asserts: + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-shared-storage")].mountPath' + value: "/mnt/shared" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-shared-storage")].persistentVolumeClaim.claimName' + value: "RELEASE-NAME-rstudio-workbench-shared-storage" + - it: should specify a volumeMount and a volume for sharedStorage if sharedStorage.mount is true + template: deployment.yaml + set: + sharedStorage: + mount: true + path: "/mnt/shared" + asserts: + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-shared-storage")].mountPath' + value: "/mnt/shared" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-shared-storage")].persistentVolumeClaim.claimName' + value: "RELEASE-NAME-rstudio-workbench-shared-storage" From 0410625601cc2abae31d8dfa765bedcdf98803cb Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Fri, 22 Nov 2024 09:44:36 -0500 Subject: [PATCH 08/12] Add homeStorage tests --- .../tests/deployment_test.yaml | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/ci/rstudio-workbench/tests/deployment_test.yaml b/ci/rstudio-workbench/tests/deployment_test.yaml index 61c66243..19bb2abd 100644 --- a/ci/rstudio-workbench/tests/deployment_test.yaml +++ b/ci/rstudio-workbench/tests/deployment_test.yaml @@ -167,3 +167,67 @@ tests: - equal: path: 'spec.template.spec.volumes[?(@.name=="rstudio-shared-storage")].persistentVolumeClaim.claimName' value: "RELEASE-NAME-rstudio-workbench-shared-storage" + - it: should specify a volumeMount and a volume for homeStorage if homeStorage.create is true + template: deployment.yaml + set: + homeStorage: + create: true + path: "/mnt/shared" + asserts: + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-home-storage")].mountPath' + value: "/mnt/shared" + - notExists: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-home-storage")].subPath' + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-home-storage")].persistentVolumeClaim.claimName' + value: "RELEASE-NAME-rstudio-workbench-home-storage" + - it: should specify a volumeMount and a volume for homeStorage if homeStorage.mount is true + template: deployment.yaml + set: + homeStorage: + mount: true + path: "/mnt/shared" + asserts: + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-home-storage")].mountPath' + value: "/mnt/shared" + - notExists: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-home-storage")].subPath' + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-home-storage")].persistentVolumeClaim.claimName' + value: "RELEASE-NAME-rstudio-workbench-home-storage" + - it: should specify a volumeMount and a volume for homeStorage if homeStorage.create is true + template: deployment.yaml + set: + homeStorage: + create: true + path: "/mnt/shared" + subPath: "subpath" + asserts: + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-home-storage")].mountPath' + value: "/mnt/shared" + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-home-storage")].subPath' + value: "subpath" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-home-storage")].persistentVolumeClaim.claimName' + value: "RELEASE-NAME-rstudio-workbench-home-storage" + - it: should specify a volumeMount and a volume for homeStorage if homeStorage.mount is true + template: deployment.yaml + set: + homeStorage: + mount: true + path: "/mnt/shared" + subPath: "subpath" + asserts: + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-home-storage")].mountPath' + value: "/mnt/shared" + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-home-storage")].subPath' + value: "subpath" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-home-storage")].persistentVolumeClaim.claimName' + value: "RELEASE-NAME-rstudio-workbench-home-storage" From fc81d6653eb5953672600626cf374a88b80d1b7a Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Fri, 22 Nov 2024 10:23:39 -0500 Subject: [PATCH 09/12] Add tests for config.sessionSecret --- .../tests/deployment_test.yaml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/ci/rstudio-workbench/tests/deployment_test.yaml b/ci/rstudio-workbench/tests/deployment_test.yaml index 19bb2abd..47aa8eba 100644 --- a/ci/rstudio-workbench/tests/deployment_test.yaml +++ b/ci/rstudio-workbench/tests/deployment_test.yaml @@ -231,3 +231,38 @@ tests: - equal: path: 'spec.template.spec.volumes[?(@.name=="rstudio-home-storage")].persistentVolumeClaim.claimName' value: "RELEASE-NAME-rstudio-workbench-home-storage" + - it: should specify a volumeMount and a volume for the session secret if config.sessionSecret is defined and not empty + template: deployment.yaml + set: + config: + defaultMode: + sessionSecret: 0420 + sessionSecret: + odbc.ini: + dsn: "test" + driver: "test" + session: + defaultSecretMountPath: "/mnt/session-secret" + asserts: + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-session-secret")].mountPath' + value: "/mnt/session-secret" + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-session-secret")].name' + value: "rstudio-session-secret" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-session-secret")].name' + value: "rstudio-session-secret" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-session-secret")].secret.secretName' + value: "RELEASE-NAME-rstudio-workbench-session-secret" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-session-secret")].secret.defaultMode' + value: 0420 + - it: should not specify a volumeMount and a volume for the session secret if config.sessionSecret is not defined + template: deployment.yaml + asserts: + - notExists: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-session-secret")]' + - notExists: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-session-secret")]' From 8a5a6f246766363d7209b983300053c0ba5bac5d Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Fri, 22 Nov 2024 10:42:12 -0500 Subject: [PATCH 10/12] Add userProvisioning and startupUserProvisioning tests --- .../tests/deployment_test.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/ci/rstudio-workbench/tests/deployment_test.yaml b/ci/rstudio-workbench/tests/deployment_test.yaml index 47aa8eba..8caad170 100644 --- a/ci/rstudio-workbench/tests/deployment_test.yaml +++ b/ci/rstudio-workbench/tests/deployment_test.yaml @@ -266,3 +266,74 @@ tests: path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-session-secret")]' - notExists: path: 'spec.template.spec.volumes[?(@.name=="rstudio-session-secret")]' + - it: should specify a volumeMount and a volume for userProvisioning if config.userProvisioning is defined and not empty + template: deployment.yaml + set: + config: + defaultMode: + userProvisioning: 0600 + userProvisioning: + sssd.conf: + dsn: "test" + driver: "test" + asserts: + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-user")].mountPath' + value: "/etc/sssd/conf.d/" + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-user")].name' + value: "rstudio-user" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-user")].name' + value: "rstudio-user" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-user")].secret.secretName' + value: "RELEASE-NAME-rstudio-workbench-user" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-user")].secret.defaultMode' + value: 0600 + - it: should not specify a volumeMount and a volume for userProvisioning if config.userProvisioning is not defined + template: deployment.yaml + asserts: + - notExists: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-user")]' + - notExists: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-user")]' + - it: should specify a volumeMount and a volume for startupUserProvisioning if config.startupUserProvisioning is defined and not empty + template: deployment.yaml + set: + config: + defaultMode: + startup: 0600 + startupUserProvisioning: + sssd.conf: + dsn: "test" + driver: "test" + asserts: + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-user-startup")].mountPath' + value: "/startup/user-provisioning" + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-user-startup")].name' + value: "rstudio-user-startup" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-user-startup")].name' + value: "rstudio-user-startup" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-user-startup")].configMap.name' + value: "RELEASE-NAME-rstudio-workbench-start-user" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-user-startup")].configMap.defaultMode' + value: 0600 + - it: should not specify a volumeMount and a volume for startupUserProvisioning if config.startupUserProvisioning is not defined + template: deployment.yaml + set: + config: + defaultMode: + startup: 0600 + startupUserProvisioning: null + asserts: + - notExists: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-user-startup")]' + - notExists: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-user-startup")]' From 65a2a0494c00ffbd1a5aa2fed0155d87ffba96bc Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Fri, 22 Nov 2024 14:31:23 -0500 Subject: [PATCH 11/12] Add startupCustom tests --- .../tests/deployment_test.yaml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/ci/rstudio-workbench/tests/deployment_test.yaml b/ci/rstudio-workbench/tests/deployment_test.yaml index 8caad170..cacfadbb 100644 --- a/ci/rstudio-workbench/tests/deployment_test.yaml +++ b/ci/rstudio-workbench/tests/deployment_test.yaml @@ -337,3 +337,41 @@ tests: path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-user-startup")]' - notExists: path: 'spec.template.spec.volumes[?(@.name=="rstudio-user-startup")]' + - it: should specify a volumeMount and a volume for startupCustom if config.startupCustom is defined and not empty + template: deployment.yaml + set: + config: + defaultMode: + startup: 0600 + startupCustom: + sssd.conf: + dsn: "test" + driver: "test" + asserts: + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-custom-startup")].mountPath' + value: "/startup/custom" + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-custom-startup")].name' + value: "rstudio-custom-startup" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-custom-startup")].name' + value: "rstudio-custom-startup" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-custom-startup")].configMap.name' + value: "RELEASE-NAME-rstudio-workbench-start-custom" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-custom-startup")].configMap.defaultMode' + value: 0600 + - it: should not specify a volumeMount and a volume for startupCustom if config.startupCustom is not defined + template: deployment.yaml + set: + config: + defaultMode: + startup: 0600 + startupCustom: null + asserts: + - notExists: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-custom-startup")]' + - notExists: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-custom-startup")]' From c7dacb7e8fe49168c0e5ebea9562ba9794930214 Mon Sep 17 00:00:00 2001 From: "Joshua C. Forest" Date: Fri, 22 Nov 2024 14:39:10 -0500 Subject: [PATCH 12/12] Add pam tests --- .../tests/deployment_test.yaml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/ci/rstudio-workbench/tests/deployment_test.yaml b/ci/rstudio-workbench/tests/deployment_test.yaml index cacfadbb..7e4961d9 100644 --- a/ci/rstudio-workbench/tests/deployment_test.yaml +++ b/ci/rstudio-workbench/tests/deployment_test.yaml @@ -375,3 +375,44 @@ tests: path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-custom-startup")]' - notExists: path: 'spec.template.spec.volumes[?(@.name=="rstudio-custom-startup")]' + - it: should specify a volumeMount and a volume for pam if config.pam is defined and not empty + template: deployment.yaml + set: + config: + defaultMode: + pam: 0600 + pam: + thing.conf: + dsn: "test" + driver: "test" + asserts: + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-pam")].mountPath' + value: "/etc/pam.d/thing.conf" + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-pam")].name' + value: "rstudio-pam" + - equal: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-pam")].subPath' + value: "thing.conf" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-pam")].name' + value: "rstudio-pam" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-pam")].configMap.name' + value: "RELEASE-NAME-rstudio-workbench-pam" + - equal: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-pam")].configMap.defaultMode' + value: 0600 + - it: should not specify a volumeMount and a volume for pam if config.pam is not defined + template: deployment.yaml + set: + config: + defaultMode: + pam: 0600 + pam: null + asserts: + - notExists: + path: 'spec.template.spec.containers[0].volumeMounts[?(@.name=="rstudio-pam")]' + - notExists: + path: 'spec.template.spec.volumes[?(@.name=="rstudio-pam")]'