From 386bca2b927fbe2ee33f0c78782bf50e397f2741 Mon Sep 17 00:00:00 2001 From: Tobia De Koninck Date: Tue, 20 Feb 2024 15:27:31 +0100 Subject: [PATCH] Ref #32380: improve tests --- .github/workflows/workflows.yaml | 5 +++-- .../resources/shinyproxy.shinyproxy.yaml | 4 ++-- .../shinyproxy/resources/shinyproxy.shinyproxy.yaml | 4 ++-- .../shinyproxy/resources/shinyproxy.shinyproxy.yaml | 4 ++-- .../resources/shinyproxy1.shinyproxy.yaml | 4 ++-- .../resources/shinyproxy2.shinyproxy.yaml | 4 ++-- .../resources/shinyproxy3.shinyproxy.yaml | 4 ++-- .../shinyproxyoperator/helpers/MockRecyclablecheckler.kt | 2 +- .../helpers/junit/TestExecutionListener.kt | 9 +++++++-- src/test/resources/configs/additional_fqdns.yaml | 4 ++-- src/test/resources/configs/affinity_required.yaml | 4 ++-- src/test/resources/configs/affinity_topologykey.yaml | 4 ++-- src/test/resources/configs/conflict.yaml | 2 +- src/test/resources/configs/simple_config.yaml | 5 +++-- src/test/resources/configs/simple_config_clustered.yaml | 4 ++-- .../configs/simple_config_multiple_namespaces.yaml | 4 ++-- src/test/resources/configs/simple_config_subpath1.yaml | 4 ++-- src/test/resources/configs/simple_config_subpath2.yaml | 4 ++-- src/test/resources/configs/simple_config_updated.yaml | 5 +++-- .../configs/simple_config_with_ingress_patches.yaml | 4 ++-- .../resources/configs/simple_config_with_patches.yaml | 4 ++-- .../configs/simple_config_with_service_patches.yaml | 4 ++-- 22 files changed, 50 insertions(+), 42 deletions(-) diff --git a/.github/workflows/workflows.yaml b/.github/workflows/workflows.yaml index 92c863e..8277141 100644 --- a/.github/workflows/workflows.yaml +++ b/.github/workflows/workflows.yaml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - java: [ 11 ] + java: [ 17 ] kubernetes: - 'v1.24.17' - 'v1.25.15' @@ -35,9 +35,10 @@ jobs: minikube version: 'v1.32.0' kubernetes version: ${{ matrix.kubernetes }} github token: ${{ secrets.GITHUB_TOKEN }} + driver: docker - name: Pull images run: | - minikube image pull openanalytics/shinyproxy-demo + minikube image pull openanalytics/shinyproxy-integration-test-app minikube image pull curlimages/curl:latest - name: Build with Maven run: mvn -B -U clean install -DskipTests diff --git a/docs/deployment/overlays/2-clustered/shinyproxy-dept2/resources/shinyproxy.shinyproxy.yaml b/docs/deployment/overlays/2-clustered/shinyproxy-dept2/resources/shinyproxy.shinyproxy.yaml index 45a2901..9575a9b 100644 --- a/docs/deployment/overlays/2-clustered/shinyproxy-dept2/resources/shinyproxy.shinyproxy.yaml +++ b/docs/deployment/overlays/2-clustered/shinyproxy-dept2/resources/shinyproxy.shinyproxy.yaml @@ -42,11 +42,11 @@ spec: display-name: Hello Application description: Application which demonstrates the basics of a Shiny app container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: [scientists, mathematicians] - id: 06_tabsets container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: scientists - id: rstudio displayName: RStudio diff --git a/docs/deployment/overlays/2-clustered/shinyproxy/resources/shinyproxy.shinyproxy.yaml b/docs/deployment/overlays/2-clustered/shinyproxy/resources/shinyproxy.shinyproxy.yaml index e710567..fbcb126 100644 --- a/docs/deployment/overlays/2-clustered/shinyproxy/resources/shinyproxy.shinyproxy.yaml +++ b/docs/deployment/overlays/2-clustered/shinyproxy/resources/shinyproxy.shinyproxy.yaml @@ -42,11 +42,11 @@ spec: display-name: Hello Application description: Application which demonstrates the basics of a Shiny app container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: [scientists, mathematicians] - id: 06_tabsets container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: scientists - id: rstudio displayName: RStudio diff --git a/docs/deployment/overlays/3-namespaced-app-ns/shinyproxy/resources/shinyproxy.shinyproxy.yaml b/docs/deployment/overlays/3-namespaced-app-ns/shinyproxy/resources/shinyproxy.shinyproxy.yaml index f739a01..3c79e75 100644 --- a/docs/deployment/overlays/3-namespaced-app-ns/shinyproxy/resources/shinyproxy.shinyproxy.yaml +++ b/docs/deployment/overlays/3-namespaced-app-ns/shinyproxy/resources/shinyproxy.shinyproxy.yaml @@ -43,7 +43,7 @@ spec: display-name: Hello Application description: Application which demonstrates the basics of a Shiny app container-cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: [ scientists, mathematicians ] kubernetes-pod-patches: | - op: replace @@ -51,7 +51,7 @@ spec: value: my-namespace - id: 06_tabsets container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: scientists - id: rstudio displayName: RStudio diff --git a/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy1.shinyproxy.yaml b/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy1.shinyproxy.yaml index b4ae244..add98b3 100644 --- a/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy1.shinyproxy.yaml +++ b/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy1.shinyproxy.yaml @@ -45,11 +45,11 @@ spec: display-name: Hello Application description: Application which demonstrates the basics of a Shiny app container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: [scientists, mathematicians] - id: 06_tabsets container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: scientists - id: rstudio displayName: RStudio diff --git a/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy2.shinyproxy.yaml b/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy2.shinyproxy.yaml index 1b40be6..ca77a10 100644 --- a/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy2.shinyproxy.yaml +++ b/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy2.shinyproxy.yaml @@ -46,11 +46,11 @@ spec: display-name: Hello Application description: Application which demonstrates the basics of a Shiny app container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: [scientists, mathematicians] - id: 06_tabsets container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: scientists - id: rstudio displayName: RStudio diff --git a/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy3.shinyproxy.yaml b/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy3.shinyproxy.yaml index 7f8d5c9..82c9f01 100644 --- a/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy3.shinyproxy.yaml +++ b/docs/deployment/overlays/4-namespaced-multi/resources/shinyproxy3.shinyproxy.yaml @@ -46,11 +46,11 @@ spec: display-name: Hello Application description: Application which demonstrates the basics of a Shiny app container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: [scientists, mathematicians] - id: 06_tabsets container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app access-groups: scientists - id: rstudio displayName: RStudio diff --git a/src/test/kotlin/eu/openanalytics/shinyproxyoperator/helpers/MockRecyclablecheckler.kt b/src/test/kotlin/eu/openanalytics/shinyproxyoperator/helpers/MockRecyclablecheckler.kt index 83551e8..2194301 100644 --- a/src/test/kotlin/eu/openanalytics/shinyproxyoperator/helpers/MockRecyclablecheckler.kt +++ b/src/test/kotlin/eu/openanalytics/shinyproxyoperator/helpers/MockRecyclablecheckler.kt @@ -30,7 +30,7 @@ class MockRecyclableChecker : IRecyclableChecker { @Volatile var isRecyclable: Boolean = false - override fun isInstanceRecyclable(shinyProxy: ShinyProxy, shinyProxyInstance: ShinyProxyInstance): Boolean { + override suspend fun isInstanceRecyclable(shinyProxy: ShinyProxy, shinyProxyInstance: ShinyProxyInstance): Boolean { return isRecyclable } diff --git a/src/test/kotlin/eu/openanalytics/shinyproxyoperator/helpers/junit/TestExecutionListener.kt b/src/test/kotlin/eu/openanalytics/shinyproxyoperator/helpers/junit/TestExecutionListener.kt index accb2cb..b6bdbad 100644 --- a/src/test/kotlin/eu/openanalytics/shinyproxyoperator/helpers/junit/TestExecutionListener.kt +++ b/src/test/kotlin/eu/openanalytics/shinyproxyoperator/helpers/junit/TestExecutionListener.kt @@ -29,7 +29,9 @@ class TestExecutionListener : SummaryGeneratingListener() { init { Runtime.getRuntime().addShutdownHook(Thread { - summary.printTo(PrintWriter(System.out)) + if (summary != null) { + summary.printTo(PrintWriter(System.out)) + } }) } @@ -57,7 +59,10 @@ class TestExecutionListener : SummaryGeneratingListener() { println() println("\t\t--> Finished test \"${testIdentifier.displayName}\": $testExecutionResult") + if (testExecutionResult.throwable.isPresent) { + testExecutionResult.throwable.get().printStackTrace() + } println() } -} \ No newline at end of file +} diff --git a/src/test/resources/configs/additional_fqdns.yaml b/src/test/resources/configs/additional_fqdns.yaml index 27435a4..e38e328 100644 --- a/src/test/resources/configs/additional_fqdns.yaml +++ b/src/test/resources/configs/additional_fqdns.yaml @@ -30,7 +30,7 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app diff --git a/src/test/resources/configs/affinity_required.yaml b/src/test/resources/configs/affinity_required.yaml index af8f790..1f34175 100644 --- a/src/test/resources/configs/affinity_required.yaml +++ b/src/test/resources/configs/affinity_required.yaml @@ -29,7 +29,7 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app diff --git a/src/test/resources/configs/affinity_topologykey.yaml b/src/test/resources/configs/affinity_topologykey.yaml index af8c132..d5d7463 100644 --- a/src/test/resources/configs/affinity_topologykey.yaml +++ b/src/test/resources/configs/affinity_topologykey.yaml @@ -29,7 +29,7 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app diff --git a/src/test/resources/configs/conflict.yaml b/src/test/resources/configs/conflict.yaml index d9598f8..1f22bb3 100644 --- a/src/test/resources/configs/conflict.yaml +++ b/src/test/resources/configs/conflict.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: sp-example-shinyproxy-cm-f5b84adc3f917d9256a0c779fd53080f13033e + name: sp-example-shinyproxy-cm-a2460e4e35bfd14f72413e02ac6acfd0d33d7e namespace: itest data: application.yml: | diff --git a/src/test/resources/configs/simple_config.yaml b/src/test/resources/configs/simple_config.yaml index f7fda83..7cf44a1 100644 --- a/src/test/resources/configs/simple_config.yaml +++ b/src/test/resources/configs/simple_config.yaml @@ -15,6 +15,7 @@ spec: authentication: simple containerBackend: kubernetes stop-proxies-on-shutdown: false + default-stop-proxy-on-logout: false kubernetes: namespace: itest internal-networking: true @@ -30,7 +31,7 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app diff --git a/src/test/resources/configs/simple_config_clustered.yaml b/src/test/resources/configs/simple_config_clustered.yaml index 10b5ade..26abd3c 100644 --- a/src/test/resources/configs/simple_config_clustered.yaml +++ b/src/test/resources/configs/simple_config_clustered.yaml @@ -28,7 +28,7 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app diff --git a/src/test/resources/configs/simple_config_multiple_namespaces.yaml b/src/test/resources/configs/simple_config_multiple_namespaces.yaml index 5571abc..e6cb87c 100644 --- a/src/test/resources/configs/simple_config_multiple_namespaces.yaml +++ b/src/test/resources/configs/simple_config_multiple_namespaces.yaml @@ -28,13 +28,13 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app kubernetes-pod-patches: | - op: replace path: /metadata/namespace value: my-namespace - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app appNamespaces: - my-namespace diff --git a/src/test/resources/configs/simple_config_subpath1.yaml b/src/test/resources/configs/simple_config_subpath1.yaml index dbd0804..139b369 100644 --- a/src/test/resources/configs/simple_config_subpath1.yaml +++ b/src/test/resources/configs/simple_config_subpath1.yaml @@ -28,10 +28,10 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app server: servlet: context-path: /sub-path diff --git a/src/test/resources/configs/simple_config_subpath2.yaml b/src/test/resources/configs/simple_config_subpath2.yaml index 34155b2..91ee027 100644 --- a/src/test/resources/configs/simple_config_subpath2.yaml +++ b/src/test/resources/configs/simple_config_subpath2.yaml @@ -28,10 +28,10 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app server: servlet: context-path: /sub-path/ diff --git a/src/test/resources/configs/simple_config_updated.yaml b/src/test/resources/configs/simple_config_updated.yaml index 33d85e6..b7de94f 100644 --- a/src/test/resources/configs/simple_config_updated.yaml +++ b/src/test/resources/configs/simple_config_updated.yaml @@ -15,6 +15,7 @@ spec: authentication: simple containerBackend: kubernetes stop-proxies-on-shutdown: false + default-stop-proxy-on-logout: false kubernetes: namespace: itest internal-networking: true @@ -30,7 +31,7 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app diff --git a/src/test/resources/configs/simple_config_with_ingress_patches.yaml b/src/test/resources/configs/simple_config_with_ingress_patches.yaml index 29c284c..bf68f69 100644 --- a/src/test/resources/configs/simple_config_with_ingress_patches.yaml +++ b/src/test/resources/configs/simple_config_with_ingress_patches.yaml @@ -28,10 +28,10 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app kubernetesIngressPatches: | - op: add path: /metadata/annotations diff --git a/src/test/resources/configs/simple_config_with_patches.yaml b/src/test/resources/configs/simple_config_with_patches.yaml index 1007e44..6434bf0 100644 --- a/src/test/resources/configs/simple_config_with_patches.yaml +++ b/src/test/resources/configs/simple_config_with_patches.yaml @@ -28,10 +28,10 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app kubernetesPodTemplateSpecPatches: | - op: add path: /spec/containers/0/env/- diff --git a/src/test/resources/configs/simple_config_with_service_patches.yaml b/src/test/resources/configs/simple_config_with_service_patches.yaml index e48b8a4..1adf70f 100644 --- a/src/test/resources/configs/simple_config_with_service_patches.yaml +++ b/src/test/resources/configs/simple_config_with_service_patches.yaml @@ -28,10 +28,10 @@ spec: displayName: Hello Application description: Application which demonstrates the basics of a Shiny app containerCmd: [ "R", "-e", "shinyproxy::run_01_hello()" ] - containerImage: openanalytics/shinyproxy-demo + containerImage: openanalytics/shinyproxy-integration-test-app - id: 06_tabsets container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ] - container-image: openanalytics/shinyproxy-demo + container-image: openanalytics/shinyproxy-integration-test-app kubernetesServicePatches: | - op: add path: /metadata/annotations