From 5afdb09fcc067620ff4f0d2bfd34ad3f06034afb Mon Sep 17 00:00:00 2001 From: Gaius Date: Mon, 22 Apr 2024 21:38:29 +0800 Subject: [PATCH] test: add compatibility e2e testing for v2 Signed-off-by: Gaius --- .github/workflows/compatibility-e2e-v2.yml | 162 +++++++++++++++++++++ client-rs | 2 +- 2 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/compatibility-e2e-v2.yml diff --git a/.github/workflows/compatibility-e2e-v2.yml b/.github/workflows/compatibility-e2e-v2.yml new file mode 100644 index 00000000000..f1e268fa978 --- /dev/null +++ b/.github/workflows/compatibility-e2e-v2.yml @@ -0,0 +1,162 @@ +name: Compatibility E2E Test(API v2 - Rust Client) + +on: + push: + branches: [main, release-*] + paths-ignore: ["**.md", "**.png", "**.jpg", "**.svg", "**/docs/**"] + pull_request: + branches: [main, release-*] + paths-ignore: ["**.md", "**.png", "**.jpg", "**.svg", "**/docs/**"] + schedule: + - cron: '0 4 * * *' + +env: + KIND_VERSION: v0.12.0 + CONTAINERD_VERSION: v1.5.2 + KIND_CONFIG_PATH: test/testdata/kind/config-v2.yaml + DRAGONFLY_CHARTS_PATH: deploy/helm-charts/charts/dragonfly + DRAGONFLY_FILE_SERVER_PATH: test/testdata/k8s/file-server.yaml + +jobs: + compatibility_e2e_tests: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + matrix: + module: ["manager", "scheduler", "dfdaemon", "seed-peer"] + include: + - module: manager + image: manager + image-tag: v2.1.41 + chart-name: manager + - module: scheduler + image: scheduler + image-tag: v2.1.41 + chart-name: scheduler + - module: client + image: client + image-tag: v0.1.35 + chart-name: client + - module: seed-client + image: client + image-tag: v0.1.35 + chart-name: seed-client + + steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Get dependencies + run: | + go install github.com/onsi/ginkgo/v2/ginkgo@v2.12.0 + mkdir -p /tmp/artifact + + - name: Setup buildx + uses: docker/setup-buildx-action@v3 + id: buildx + with: + install: true + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Pull Rust Client Image + run: | + cd client-rs + CLIENT_TAG=$(git describe --tags $(git rev-parse HEAD)) + docker pull dragonflyoss/client:$CLIENT_TAG + docker tag dragonflyoss/client:$CLIENT_TAG dragonflyoss/client:latest + docker pull dragonflyoss/dfinit:$CLIENT_TAG + docker tag dragonflyoss/dfinit:$CLIENT_TAG dragonflyoss/dfinit:latest + + - name: Build Scheduler Image + uses: docker/build-push-action@v5 + with: + context: . + file: build/images/scheduler/Dockerfile + push: false + load: true + tags: dragonflyoss/scheduler:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + + - name: Build Manager Image + uses: docker/build-push-action@v5 + with: + context: . + file: build/images/manager/Dockerfile + push: false + load: true + tags: dragonflyoss/manager:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + + - name: Setup Kind + uses: helm/kind-action@v1.9.0 + with: + version: ${{ env.KIND_VERSION }} + config: ${{ env.KIND_CONFIG_PATH }} + cluster_name: kind + + - name: Kind load images + run: | + kind load docker-image dragonflyoss/manager:latest + kind load docker-image dragonflyoss/scheduler:latest + kind load docker-image dragonflyoss/client:latest + kind load docker-image dragonflyoss/dfinit:latest + + - name: Setup dragonfly + run: | + helm install --wait --timeout 10m --dependency-update --create-namespace --namespace dragonfly-system --set ${{ matrix.chart-name }}.image.tag=${{ matrix.image-tag }} --set ${{ matrix.chart-name }}.image.repository=dragonflyoss/${{ matrix.image }} -f ${{ env.DRAGONFLY_CHARTS_CONFIG_PATH }} dragonfly ${{ env.DRAGONFLY_CHARTS_PATH }} + kubectl apply -f ${{ env.DRAGONFLY_FILE_SERVER_PATH }} + kubectl wait po file-server-0 --namespace dragonfly-e2e --for=condition=ready --timeout=10m + kubectl get po -n dragonfly-system + + - name: Run E2E test + run: | + ginkgo -v -r --race --fail-fast --cover --trace --show-node-events --skip=${{ matrix.skip }} test/e2e/v2 + cat coverprofile.out >> coverage.txt + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.txt + flags: e2etests + + - name: Upload Logs + uses: actions/upload-artifact@v4 + if: always() + with: + name: ${{ matrix.module }}-e2e-tests-logs + path: | + /tmp/artifact/** diff --git a/client-rs b/client-rs index 8dfb776eed5..24921dc1955 160000 --- a/client-rs +++ b/client-rs @@ -1 +1 @@ -Subproject commit 8dfb776eed5acbc4ac1c32fec78ca36c61004965 +Subproject commit 24921dc195562e84bb3c9a7e8a913480e2a588fe