From d5dbb3df3e8d8d64c71011bbdd2618076b4b1c90 Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Tue, 29 Oct 2024 15:50:40 +0100 Subject: [PATCH] chore: fix TestPrometheusVersionUpgrade This change reduces the scope of the upgrade tests: we're now testing from the current LTS version (v2.45.0) to the latest stable release. Closes #7039 Signed-off-by: Simon Pasquier --- .../workflows/test-prom-version-upgrade.yaml | 11 ++++--- Documentation/compatibility.md | 27 ---------------- pkg/operator/defaults.go | 31 ++---------------- test/e2e/prometheus_test.go | 32 ++++++++++--------- 4 files changed, 26 insertions(+), 75 deletions(-) diff --git a/.github/workflows/test-prom-version-upgrade.yaml b/.github/workflows/test-prom-version-upgrade.yaml index fde968cac..6e02e840a 100644 --- a/.github/workflows/test-prom-version-upgrade.yaml +++ b/.github/workflows/test-prom-version-upgrade.yaml @@ -9,6 +9,11 @@ jobs: name: Upgrade Prometheus runs-on: ubuntu-latest steps: + - name: Reclaim disk space + run: | + docker image prune --force --all + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android - uses: actions/checkout@v4 - name: Import environment variables from file run: | @@ -19,10 +24,6 @@ jobs: with: go-version: '${{ env.golang-version }}' check-latest: true - - name: Build images - run: | - export SHELL=/bin/bash - make build image - name: Start KinD uses: helm/kind-action@v1.10.0 with: @@ -36,7 +37,7 @@ jobs: kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s kubectl cluster-info kubectl get pods -A - - name: Load images + - name: Build and load images run: | make test-e2e-images kubectl apply -f scripts/kind-rbac.yaml diff --git a/Documentation/compatibility.md b/Documentation/compatibility.md index 2f494b901..52b2aecdd 100644 --- a/Documentation/compatibility.md +++ b/Documentation/compatibility.md @@ -30,32 +30,6 @@ v0.31.2 Prometheus Operator supports all Prometheus versions >= v2.0.0. The operator's end-to-end tests verify that the operator can deploy the following Prometheus versions: ```$ mdox-exec="go run ./cmd/po-docgen/. compatibility" -* v2.37.0 -* v2.37.1 -* v2.37.2 -* v2.37.3 -* v2.37.4 -* v2.37.5 -* v2.37.6 -* v2.37.7 -* v2.37.8 -* v2.38.0 -* v2.39.0 -* v2.39.1 -* v2.39.2 -* v2.40.0 -* v2.40.1 -* v2.40.2 -* v2.40.3 -* v2.40.4 -* v2.40.5 -* v2.40.6 -* v2.40.7 -* v2.41.0 -* v2.42.0 -* v2.43.0 -* v2.43.1 -* v2.44.0 * v2.45.0 * v2.46.0 * v2.47.0 @@ -71,7 +45,6 @@ Prometheus Operator supports all Prometheus versions >= v2.0.0. The operator's e * v2.51.1 * v2.51.2 * v2.52.0 -* v2.52.1 * v2.53.0 * v2.53.1 * v2.54.0 diff --git a/pkg/operator/defaults.go b/pkg/operator/defaults.go index 6c991dae6..a77afb6a9 100644 --- a/pkg/operator/defaults.go +++ b/pkg/operator/defaults.go @@ -48,35 +48,9 @@ var ( DefaultPrometheusConfigReloaderImage = "quay.io/prometheus-operator/prometheus-config-reloader:v" + version.Version // PrometheusCompatibilityMatrix is a list of supported prometheus versions. - // prometheus-operator end-to-end tests verify that the operator can deploy from LTS n-1 to the latest stable. + // prometheus-operator end-to-end tests verify that the operator can deploy from the current LTS version to the latest stable release. // This list should be updated every time a new LTS is released. PrometheusCompatibilityMatrix = []string{ - "v2.37.0", - "v2.37.1", - "v2.37.2", - "v2.37.3", - "v2.37.4", - "v2.37.5", - "v2.37.6", - "v2.37.7", - "v2.37.8", - "v2.38.0", - "v2.39.0", - "v2.39.1", - "v2.39.2", - "v2.40.0", - "v2.40.1", - "v2.40.2", - "v2.40.3", - "v2.40.4", - "v2.40.5", - "v2.40.6", - "v2.40.7", - "v2.41.0", - "v2.42.0", - "v2.43.0", - "v2.43.1", - "v2.44.0", "v2.45.0", "v2.46.0", "v2.47.0", @@ -92,7 +66,8 @@ var ( "v2.51.1", "v2.51.2", "v2.52.0", - "v2.52.1", + // The v2.52.1 image tag is missing from docker.io and quay.io registries. + // "v2.52.1", "v2.53.0", "v2.53.1", "v2.54.0", diff --git a/test/e2e/prometheus_test.go b/test/e2e/prometheus_test.go index 8a822a6b4..98528e3d9 100644 --- a/test/e2e/prometheus_test.go +++ b/test/e2e/prometheus_test.go @@ -853,22 +853,24 @@ func testPromVersionMigration(t *testing.T) { } for _, v := range compatibilityMatrix { - p, err = framework.PatchPrometheusAndWaitUntilReady( - context.Background(), - p.Name, - ns, - monitoringv1.PrometheusSpec{ - CommonPrometheusFields: monitoringv1.CommonPrometheusFields{ - Version: v, + t.Run("to "+v, func(t *testing.T) { + p, err = framework.PatchPrometheusAndWaitUntilReady( + context.Background(), + name, + ns, + monitoringv1.PrometheusSpec{ + CommonPrometheusFields: monitoringv1.CommonPrometheusFields{ + Version: v, + }, }, - }, - ) - if err != nil { - t.Fatalf("update to version %s: %v", v, err) - } - if err := framework.WaitForPrometheusRunImageAndReady(context.Background(), ns, p); err != nil { - t.Fatalf("update to version %s: %v", v, err) - } + ) + if err != nil { + t.Fatalf("update to version %s: %v", v, err) + } + if err := framework.WaitForPrometheusRunImageAndReady(context.Background(), ns, p); err != nil { + t.Fatalf("update to version %s: %v", v, err) + } + }) } }