From c855d73a74156fe52511dced9d9af3020140bb26 Mon Sep 17 00:00:00 2001 From: Zixin Zhou Date: Sun, 5 Jan 2025 21:29:17 +0800 Subject: [PATCH] [chore] add more Windows versions for testing --- .github/workflows/build-and-test-windows.yml | 3 ++- .github/workflows/e2e-tests-windows.yml | 18 +++++++++++++++--- .../exporter_concurrency_test.go | 10 ++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-test-windows.yml b/.github/workflows/build-and-test-windows.yml index dafbfe3838a8..b4d56ec35f48 100644 --- a/.github/workflows/build-and-test-windows.yml +++ b/.github/workflows/build-and-test-windows.yml @@ -45,7 +45,8 @@ jobs: - cmd-0 - cmd-1 - other - runs-on: windows-latest + os: [windows-2022, windows-2025] + runs-on: ${{ matrix.os }} if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push' || github.event_name == 'merge_group') }} env: # Limit memory usage via GC environment variables to avoid OOM on GH runners, especially for `cmd/otelcontribcol`, diff --git a/.github/workflows/e2e-tests-windows.yml b/.github/workflows/e2e-tests-windows.yml index bcfb4f38d865..6c1afe9c7f9a 100644 --- a/.github/workflows/e2e-tests-windows.yml +++ b/.github/workflows/e2e-tests-windows.yml @@ -32,7 +32,11 @@ jobs: - run: echo $(./.github/workflows/scripts/is_changed_file_windows.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }} ) collector-build: - runs-on: windows-latest + strategy: + fail-fast: false + matrix: + os: [windows-2022, windows-2025] + runs-on: ${{ matrix.os }} needs: [windows-file-changed] if: ${{ github.actor != 'dependabot[bot]' && ((contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push' || github.event_name == 'merge_group') || needs.windows-file-changed.outputs.changed == 'true') }} steps: @@ -65,7 +69,11 @@ jobs: path: ./bin/* supervisor-test: - runs-on: windows-latest + strategy: + fail-fast: false + matrix: + os: [windows-2022, windows-2025] + runs-on: ${{ matrix.os }} if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push' || github.event_name == 'merge_group') }} needs: [collector-build] steps: @@ -97,7 +105,11 @@ jobs: go test -v --tags=e2e windows-supervisor-service-test: - runs-on: windows-latest + strategy: + fail-fast: false + matrix: + os: [windows-2022, windows-2025] + runs-on: ${{ matrix.os }} if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push' || github.event_name == 'merge_group') }} needs: [collector-build] steps: diff --git a/exporter/prometheusremotewriteexporter/exporter_concurrency_test.go b/exporter/prometheusremotewriteexporter/exporter_concurrency_test.go index 689cbcf7b9fc..2a2b4f00184e 100644 --- a/exporter/prometheusremotewriteexporter/exporter_concurrency_test.go +++ b/exporter/prometheusremotewriteexporter/exporter_concurrency_test.go @@ -52,6 +52,10 @@ func Test_PushMetricsConcurrent(t *testing.T) { t.Fatal(err) } assert.NotNil(t, body) + if len(body) == 0 { + // No content, nothing to do. The request is just checking that the server is up. + return + } // Receives the http requests and unzip, unmarshalls, and extracts TimeSeries assert.Equal(t, "0.1.0", r.Header.Get("X-Prometheus-Remote-Write-Version")) assert.Equal(t, "snappy", r.Header.Get("Content-Encoding")) @@ -124,6 +128,12 @@ func Test_PushMetricsConcurrent(t *testing.T) { require.NoError(t, prwe.Shutdown(ctx)) }() + // Ensure that the test server is up before making the requests + assert.EventuallyWithT(t, func(c *assert.CollectT) { + _, checkRequestErr := http.Get(server.URL) + assert.NoError(c, checkRequestErr) + }, 5*time.Second, 100*time.Millisecond) + var wg sync.WaitGroup wg.Add(n) for _, m := range ms {