From 1032b0133a7dc279051a9392cccd9909b568a70c Mon Sep 17 00:00:00 2001 From: Aayush Chouhan Date: Mon, 11 Nov 2024 21:46:43 +0530 Subject: [PATCH] Added upgrade tests Signed-off-by: Aayush Chouhan --- .github/workflows/upgrade-tests.yaml | 91 ++++++++++++++++++++++ Makefile | 5 ++ src/test/system_tests/run_upgrade_tests.sh | 2 + 3 files changed, 98 insertions(+) create mode 100644 .github/workflows/upgrade-tests.yaml create mode 100644 src/test/system_tests/run_upgrade_tests.sh diff --git a/.github/workflows/upgrade-tests.yaml b/.github/workflows/upgrade-tests.yaml new file mode 100644 index 0000000000..7d49e26b3a --- /dev/null +++ b/.github/workflows/upgrade-tests.yaml @@ -0,0 +1,91 @@ +name: Upgrade Tests +on: [push, pull_request, workflow_dispatch] + +jobs: + upgrade-tests: + runs-on: ubuntu-latest + timeout-minutes: 90 + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + + env: + BRANCH_NAME: ${{ github.event.inputs.branch || '5.17' }} + + steps: + - name: Checkout noobaa-core + uses: actions/checkout@v4 + with: + repository: 'noobaa/noobaa-core' + path: 'noobaa-core' + + - name: Save current branch name + run: | + cd ./noobaa-core + echo "CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV + + - name: Checkout and install version ${{ env.BRANCH_NAME }} + run: | + cd ./noobaa-core + git remote add upstream https://github.com/noobaa/noobaa-core.git + git fetch upstream ${{ env.BRANCH_NAME }}:${{ env.BRANCH_NAME }} + git checkout ${{ env.BRANCH_NAME }} + git reset --hard upstream/${{ env.BRANCH_NAME }} + + - name: Deploy minikube + run: | + cd ./noobaa-core + sudo bash ./.travis/deploy_minikube.sh + + - name: Build noobaa tester + run: | + cd ./noobaa-core + make tester TESTER_TAG=noobaa-tester:upgrade-tests + docker tag noobaa:latest noobaa-core:upgrade-tests + + - name: Checkout noobaa-operator + uses: actions/checkout@v3 + with: + repository: 'noobaa/noobaa-operator' + path: 'noobaa-operator' + ref: ${{ env.BRANCH_NAME }} + + - name: Change settings for k8s and minikube + run: | + sudo mv /root/.kube /root/.minikube $HOME + sudo chown -R $USER $HOME/.kube $HOME/.minikube + sed "s/root/home\/$USER/g" $HOME/.kube/config > tmp; mv tmp $HOME/.kube/config + + - name: Build operator + run: | + cd ./noobaa-operator + make all + + - name: Install noobaa system + run: | + cd ./noobaa-operator + ./build/_output/bin/noobaa-operator crd create + ./build/_output/bin/noobaa-operator operator install + ./build/_output/bin/noobaa-operator system create \ + --db-resources='{ "limits": {"cpu": "200m","memory": "2G"}, "requests": {"cpu": "200m","memory": "2G"}}' \ + --core-resources='{ "limits": {"cpu": "200m","memory": "1G"}, "requests": {"cpu": "200m","memory": "1G"}}' \ + --endpoint-resources='{ "limits": {"cpu": "200m","memory": "1G"}, "requests": {"cpu": "200m","memory": "1G"}}' \ + --noobaa-image='noobaa-core:upgrade-tests' + ./build/_output/bin/noobaa-operator status + + - name: Wait for phase Ready in the backingstore pod + run: | + cd ./noobaa-operator + ./.travis/number_of_pods_in_system.sh --pods 5 + kubectl wait --for=condition=available backingstore/noobaa-default-backing-store --timeout=5m + + - name: Checkout back to current branch + run: | + cd ./noobaa-core + git checkout ${{ env.CURRENT_BRANCH }} + + - name: Run Upgrade Tests + run: | + set -x + cd ./noobaa-core + make test-upgrade diff --git a/Makefile b/Makefile index fe9057de73..4570ce2ade 100644 --- a/Makefile +++ b/Makefile @@ -332,6 +332,11 @@ test-external-pg-sanity: build-ssl-postgres @$(call remove_docker_network) .PHONY: test-external-pg-sanity +test-upgrade: tester + @echo "\033[1;34mRunning Upgrade Tests - after upgrading from 5.17.0 to latest\033[0m" + ./src/test/system_tests/run_upgrade_tests.sh || exit 1 +.PHONY: test-upgrade + clean: @echo Stopping and Deleting containers @$(CONTAINER_ENGINE) ps -a | grep noobaa_ | awk '{print $1}' | xargs $(CONTAINER_ENGINE) stop &> /dev/null diff --git a/src/test/system_tests/run_upgrade_tests.sh b/src/test/system_tests/run_upgrade_tests.sh new file mode 100644 index 0000000000..c651422687 --- /dev/null +++ b/src/test/system_tests/run_upgrade_tests.sh @@ -0,0 +1,2 @@ +echo "Executing upgrade tests..." +# TODO \ No newline at end of file