diff --git a/.github/workflows/integration-test-helm-suite.yaml b/.github/workflows/integration-test-helm-suite.yaml index 4541593ee..09ed265c2 100644 --- a/.github/workflows/integration-test-helm-suite.yaml +++ b/.github/workflows/integration-test-helm-suite.yaml @@ -35,6 +35,11 @@ jobs: with: fetch-depth: 0 + - name: Set up Helm + uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0 + with: + version: v3.18.2 + - name: consider debugging uses: ./.github/workflows/tmate_debug with: @@ -53,7 +58,6 @@ jobs: run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background tests/scripts/github-action-helper.sh create_helm_tag - tests/scripts/helm.sh up export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_TEST_CLEANUP=false SKIP_CLEANUP_POLICY=false go test -v -timeout 1800s -failfast -run CephHelmSuite github.com/rook/rook/tests/integration diff --git a/.github/workflows/integration-test-keystone-auth-suite.yaml b/.github/workflows/integration-test-keystone-auth-suite.yaml index a0458482d..b05ce0e3e 100644 --- a/.github/workflows/integration-test-keystone-auth-suite.yaml +++ b/.github/workflows/integration-test-keystone-auth-suite.yaml @@ -35,6 +35,11 @@ jobs: with: fetch-depth: 0 + - name: Set up Helm + uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0 + with: + version: v3.18.2 + - name: consider debugging uses: ./.github/workflows/tmate_debug with: @@ -50,7 +55,6 @@ jobs: - name: TestCephKeystoneAuthSuite run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background - tests/scripts/helm.sh up export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) SKIP_CLEANUP_POLICY=false go test -v -timeout 3600s -failfast -run CephKeystoneAuthSuite github.com/rook/rook/tests/integration diff --git a/.github/workflows/integration-test-upgrade-suite.yaml b/.github/workflows/integration-test-upgrade-suite.yaml index 9715df243..2e71b17d0 100644 --- a/.github/workflows/integration-test-upgrade-suite.yaml +++ b/.github/workflows/integration-test-upgrade-suite.yaml @@ -80,6 +80,11 @@ jobs: with: fetch-depth: 0 + - name: Set up Helm + uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0 + with: + version: v3.18.2 + - name: consider debugging uses: ./.github/workflows/tmate_debug with: @@ -94,7 +99,6 @@ jobs: - name: TestHelmUpgradeSuite run: | tests/scripts/github-action-helper.sh create_helm_tag - tests/scripts/helm.sh up tests/scripts/github-action-helper.sh collect_udev_logs_in_background export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) diff --git a/.github/workflows/integration-tests-on-release.yaml b/.github/workflows/integration-tests-on-release.yaml index 1da912d1c..f515a4194 100644 --- a/.github/workflows/integration-tests-on-release.yaml +++ b/.github/workflows/integration-tests-on-release.yaml @@ -37,7 +37,6 @@ jobs: run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background tests/scripts/github-action-helper.sh create_helm_tag - tests/scripts/helm.sh up export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_TEST_CLEANUP=false SKIP_CLEANUP_POLICY=false go test -v -timeout 1800s -run CephHelmSuite github.com/rook/rook/tests/integration @@ -193,8 +192,6 @@ jobs: - name: TestHelmUpgradeSuite run: | tests/scripts/github-action-helper.sh create_helm_tag - tests/scripts/helm.sh up - tests/scripts/github-action-helper.sh collect_udev_logs_in_background export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) go test -v -timeout 1800s -run CephUpgradeSuite/TestUpgradeHelm github.com/rook/rook/tests/integration diff --git a/Documentation/Contributing/rook-test-framework.md b/Documentation/Contributing/rook-test-framework.md index bc0d5ace5..9b8b29d77 100644 --- a/Documentation/Contributing/rook-test-framework.md +++ b/Documentation/Contributing/rook-test-framework.md @@ -61,6 +61,9 @@ export TEST_BASE_DIR=WORKING_DIR export TEST_SCRATCH_DEVICE=/dev/vdb ``` +The `helm` tool is expected to be installed on the system. If it is not available in the `$PATH`, set the variable `TEST_HELM_PATH`. +otherwise, it should be set to the non-standard location of the `helm` binary. + Set `TEST_SCRATCH_DEVICE` to the correct block device name based on the driver that's being used. !!! hint diff --git a/tests/framework/installer/ceph_installer.go b/tests/framework/installer/ceph_installer.go index d9bbe12dc..f1b9f38a4 100644 --- a/tests/framework/installer/ceph_installer.go +++ b/tests/framework/installer/ceph_installer.go @@ -981,7 +981,7 @@ func NewCephInstaller(t func() *testing.T, clientset *kubernetes.Clientset, sett settings: settings, Manifests: NewCephManifests(settings), k8shelper: k8shelp, - helmHelper: utils.NewHelmHelper(testHelmPath()), + helmHelper: utils.NewHelmHelper(TestHelmPath()), k8sVersion: version.String(), changeHostnames: settings.ChangeHostName, T: t, diff --git a/tests/framework/installer/environment.go b/tests/framework/installer/environment.go index 1ba1f29e6..4e43e9889 100644 --- a/tests/framework/installer/environment.go +++ b/tests/framework/installer/environment.go @@ -18,11 +18,18 @@ package installer import ( "os" + "os/exec" ) -// testHelmPath gets the helm path -func testHelmPath() string { - return getEnvVarWithDefault("TEST_HELM_PATH", "/tmp/rook-tests-scripts-helm/helm") +// TestHelmPath gets the path of the helm binary +func TestHelmPath() string { + helmPath := os.Getenv("TEST_HELM_PATH") + if helmPath == "" { + if path, err := exec.LookPath("helm"); err == nil { + helmPath = path + } + } + return helmPath } // TestLogCollectionLevel gets whether to collect all logs diff --git a/tests/integration/ceph_base_keystone_test.go b/tests/integration/ceph_base_keystone_test.go index 8a1bc8b5d..b374f7f5d 100644 --- a/tests/integration/ceph_base_keystone_test.go +++ b/tests/integration/ceph_base_keystone_test.go @@ -18,7 +18,6 @@ package integration import ( "context" - "os" "testing" "github.com/rook/rook/tests/framework/clients" @@ -85,12 +84,7 @@ func InstallKeystoneInTestCluster(shelper *utils.K8sHelper, namespace string) er // the helm installer uses the rook repository and cannot be used as is // therefore parts of the installer are adapted here - // use helm path from environment (the same is used by the helm installer) - helmPath := os.Getenv("TEST_HELM_PATH") - if helmPath == "" { - helmPath = "/tmp/rook-tests-scripts-helm/helm" - } - helmHelper := utils.NewHelmHelper(helmPath) + helmHelper := utils.NewHelmHelper(installer.TestHelmPath()) // add the cert-manager helm repo logger.Infof("adding cert-manager helm repo") diff --git a/tests/scripts/helm.sh b/tests/scripts/helm.sh deleted file mode 100755 index 9061eaa66..000000000 --- a/tests/scripts/helm.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env -S bash +e - -temp="/tmp/rook-tests-scripts-helm" - -helm_version="${HELM_VERSION:-"v3.18.2"}" -arch="${ARCH:-}" - -detectArch() { - case "$(uname -m)" in - "x86_64" | "amd64") - arch="amd64" - ;; - "aarch64") - arch="arm64" - ;; - "i386") - arch="i386" - ;; - *) - echo "Couldn't translate 'uname -m' output to an available arch." - echo "Try setting ARCH environment variable to your system arch:" - echo "amd64, x86_64. aarch64, i386" - exit 1 - ;; - esac -} - -install() { - # Download and unpack helm - local dist - dist="$(uname -s)" - dist=$(echo "${dist}" | tr "[:upper:]" "[:lower:]") - mkdir -p "${temp}" - wget "https://get.helm.sh/helm-${helm_version}-${dist}-${arch}.tar.gz" -O "${temp}/helm.tar.gz" - tar -C "${temp}" -xvf "${temp}/helm.tar.gz" --strip-components 1 -} - -if [ -z "${arch}" ]; then - detectArch -fi - -case "${1:-}" in - up) - install - ;; - *) - echo "usage:" >&2 - echo " $0 up" >&2 -esac