From 365d278a396b871080695eea1e2ebf2c4e539f3d Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Thu, 1 Feb 2024 12:41:29 -0700 Subject: [PATCH] [chore] Parallelize e2e tests (#31004) Reorganizes job dependencies and parallelizes the k8s tests Related to https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/30880 **Testing** https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/7745609364 --- .github/workflows/e2e-tests.yml | 108 +++++++++++++++++--------------- 1 file changed, 59 insertions(+), 49 deletions(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index a297f8a4bc1a..b9ae319a6470 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -41,12 +41,12 @@ jobs: with: name: collector-binary path: ./bin/* - docker-build: + + supervisor-test: runs-on: ubuntu-latest needs: collector-build steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: ~1.20.8 @@ -69,6 +69,32 @@ jobs: name: collector-binary path: bin/ - run: chmod +x bin/* + - name: Run opampsupervisor e2e tests + run: | + cd cmd/opampsupervisor + go test -v --tags=e2e + + docker-build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ~1.20.8 + cache: false + - name: Cache Go + id: go-cache + timeout-minutes: 5 + uses: actions/cache@v3 + with: + path: | + ~/go/bin + ~/go/pkg/mod + key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} + - name: Install dependencies + if: steps.go-cache.outputs.cache-hit != 'true' + run: make -j2 gomoddownload - name: Build Docker Image run: | make docker-otelcontribcol @@ -80,12 +106,22 @@ jobs: with: name: otelcontribcol path: /tmp/otelcontribcol.tar - kubernetes-test: + + kubernetes-test-matrix: env: KUBECONFIG: /tmp/kube-config-otelcol-e2e-testing strategy: matrix: - k8s-version: ["v1.26.0", "v1.25.3", "v1.24.7", "v1.23.13"] + k8s-version: + - "v1.26.0" + - "v1.25.3" + - "v1.24.7" + - "v1.23.13" + component: + - receiver/k8sclusterreceiver + - processor/k8sattributesprocessor + - receiver/kubeletstatsreceiver + - receiver/k8sobjectsreceiver runs-on: ubuntu-latest needs: docker-build steps: @@ -102,7 +138,7 @@ jobs: path: | ~/go/bin ~/go/pkg/mod - key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} + key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} - name: Install dependencies if: steps.go-cache.outputs.cache-hit != 'true' run: make -j2 gomoddownload @@ -127,51 +163,25 @@ jobs: - name: Kind load image run: | kind load docker-image otelcontribcol:latest --name kind - - name: run k8sclusterreceiver e2e tests + - name: Run e2e tests run: | - cd receiver/k8sclusterreceiver + cd ${{ matrix.component }} go test -v --tags=e2e - - name: run k8sattributesprocessor e2e tests - run: | - cd processor/k8sattributesprocessor - go test -v --tags=e2e - - name: run receiver/kubeletstatsreceiver e2e tests - run: | - cd receiver/kubeletstatsreceiver - go test -v --tags=e2e - - name: run receiver/k8sobjectsreceiver e2e tests - run: | - cd receiver/k8sobjectsreceiver - go test -v --tags=e2e - supervisor-test: + + kubernetes-test: + if: ${{ github.actor != 'dependabot[bot]' && always() }} runs-on: ubuntu-latest - needs: collector-build + needs: [ kubernetes-test-matrix ] steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ~1.20.8 - cache: false - - name: Cache Go - id: go-cache - timeout-minutes: 5 - uses: actions/cache@v3 - with: - path: | - ~/go/bin - ~/go/pkg/mod - key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} - - name: Install dependencies - if: steps.go-cache.outputs.cache-hit != 'true' - run: make -j2 gomoddownload - - name: Download Collector Binary - uses: actions/download-artifact@v3 - with: - name: collector-binary - path: bin/ - - run: chmod +x bin/* - - name: Run opampsupervisor e2e tests - run: | - cd cmd/opampsupervisor - go test -v --tags=e2e + - name: Print result + run: echo ${{ needs.kubernetes-test-matrix.result }} + - name: Interpret result + run: | + if [[ success == ${{ needs.kubernetes-test-matrix.result }} ]] + then + echo "All matrix jobs passed!" + else + echo "One or more matrix jobs failed." + false + fi