From e1c4f173642919578020cd56621964e83959712c Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Fri, 29 Mar 2024 03:59:43 +0000 Subject: [PATCH] test(chart): test template from chart package tgz Signed-off-by: Viet Nguyen Duc --- tests/charts/bootstrap.sh | 7 +++++-- tests/charts/templates/test.py | 8 ++++---- tests/charts/umbrella-charts/values.yaml | 6 ++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/charts/bootstrap.sh b/tests/charts/bootstrap.sh index 15ee771cf..d5a562f69 100755 --- a/tests/charts/bootstrap.sh +++ b/tests/charts/bootstrap.sh @@ -13,13 +13,15 @@ python -m pip install pyyaml==6.0.1 \ cd .. +helm package charts/selenium-grid --version 1.0.0-SNAPSHOT -d tests/tests + RELEASE_NAME="selenium" helm template ${RELEASE_NAME} --values tests/charts/templates/render/dummy.yaml \ --set-file 'nodeConfigMap.extraScripts.setFromCommand\.sh=tests/charts/templates/render/dummy_external.sh' \ --set-file 'recorderConfigMap.extraScripts.setFromCommand\.sh=tests/charts/templates/render/dummy_external.sh' \ --set-file 'uploaderConfigMap.extraScripts.setFromCommand\.sh=tests/charts/templates/render/dummy_external.sh' \ - charts/selenium-grid > ./tests/tests/dummy_template_manifests.yaml + tests/tests/selenium-grid-1.0.0-SNAPSHOT.tgz > ./tests/tests/dummy_template_manifests.yaml python tests/charts/templates/test.py "./tests/tests/dummy_template_manifests.yaml" ${RELEASE_NAME} if [ $? -ne 0 ]; then @@ -30,6 +32,7 @@ fi rm -rf tests/charts/umbrella-charts/Chart.lock tests/charts/umbrella-charts/charts helm dependency update tests/charts/umbrella-charts helm dependency build tests/charts/umbrella-charts +helm package tests/charts/umbrella-charts --version 1.0.0-SNAPSHOT -d tests/tests RELEASE_NAME="test" @@ -37,7 +40,7 @@ helm template ${RELEASE_NAME} --values tests/charts/templates/render/dummy_solut --set-file 'selenium-grid.nodeConfigMap.extraScripts.setFromCommand\.sh=tests/charts/templates/render/dummy_external.sh' \ --set-file 'selenium-grid.recorderConfigMap.extraScripts.setFromCommand\.sh=tests/charts/templates/render/dummy_external.sh' \ --set-file 'selenium-grid.uploaderConfigMap.extraScripts.setFromCommand\.sh=tests/charts/templates/render/dummy_external.sh' \ - tests/charts/umbrella-charts > ./tests/tests/dummy_solution_template_manifests.yaml + tests/tests/umbrella-charts-1.0.0-SNAPSHOT.tgz > ./tests/tests/dummy_solution_template_manifests.yaml python tests/charts/templates/test.py "./tests/tests/dummy_solution_template_manifests.yaml" ${RELEASE_NAME} if [ $? -ne 0 ]; then diff --git a/tests/charts/templates/test.py b/tests/charts/templates/test.py index 3908fb42b..fdc55d172 100644 --- a/tests/charts/templates/test.py +++ b/tests/charts/templates/test.py @@ -154,10 +154,10 @@ def test_extra_script_import_to_node_configmap(self): for doc in LIST_OF_DOCUMENTS: if doc['metadata']['name'] in resources_name and doc['kind'] == 'ConfigMap': logger.info(f"Assert default file is imported to Node ConfigMap") - self.assertTrue(doc['data']['nodeProbe.sh'] is not None) - self.assertTrue(doc['data']['nodePreStop.sh'] is not None) - self.assertTrue(doc['data']['nodeCustomTask.sh'] is not None) - self.assertTrue(doc['data']['setFromCommand.sh'] is not None) + self.assertTrue(doc['data']['nodeProbe.sh'] != "") + self.assertTrue(doc['data']['nodePreStop.sh'] != "") + self.assertTrue(doc['data']['nodeCustomTask.sh'] != "") + self.assertTrue(doc['data']['setFromCommand.sh'] != "") count += 1 self.assertEqual(count, len(resources_name), "No node config resources found") diff --git a/tests/charts/umbrella-charts/values.yaml b/tests/charts/umbrella-charts/values.yaml index e69de29bb..4107d97d8 100644 --- a/tests/charts/umbrella-charts/values.yaml +++ b/tests/charts/umbrella-charts/values.yaml @@ -0,0 +1,6 @@ +global: + seleniumGrid: + imageRegistry: selenium + +selenium-grid: + enabled: true