mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-21 03:38:43 +00:00
Merge pull request #6665 from prometheus-operator/feature-gated-tests
chore: Add feature-gated tests to CI
This commit is contained in:
commit
7b23fd648f
5 changed files with 86 additions and 19 deletions
64
.github/workflows/e2e-feature-gated.yaml
vendored
Normal file
64
.github/workflows/e2e-feature-gated.yaml
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
name: e2e-feature-gated
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
push:
|
||||
branches:
|
||||
- 'release-*'
|
||||
- 'master'
|
||||
- 'main'
|
||||
tags:
|
||||
- 'v*'
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
jobs:
|
||||
e2e-tests:
|
||||
name: E2E tests for feature gates
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Import environment variables from file
|
||||
run: cat ".github/env" >> $GITHUB_ENV
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '${{ env.golang-version }}'
|
||||
check-latest: true
|
||||
- name: Build images
|
||||
run: |
|
||||
export SHELL=/bin/bash
|
||||
make build image
|
||||
- name: Start kind cluster
|
||||
uses: helm/kind-action@v1.10.0
|
||||
with:
|
||||
version: ${{ env.kind-version }}
|
||||
node_image: ${{ env.kind-image }}
|
||||
wait: 300s
|
||||
config: ./test/e2e/kind-conf.yaml
|
||||
cluster_name: e2e
|
||||
- name: Wait for cluster to finish bootstraping
|
||||
run: |
|
||||
echo "Waiting for all nodes to be ready..."
|
||||
kubectl wait --for=condition=Ready nodes --all --timeout=120s
|
||||
kubectl get nodes
|
||||
echo "Waiting for all pods to be ready..."
|
||||
kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s
|
||||
kubectl get pods -A
|
||||
echo "Cluster information"
|
||||
kubectl cluster-info
|
||||
- name: Load images
|
||||
run: |
|
||||
kind load docker-image -n e2e quay.io/prometheus-operator/prometheus-operator:$(git rev-parse --short HEAD)
|
||||
kind load docker-image -n e2e quay.io/prometheus-operator/prometheus-config-reloader:$(git rev-parse --short HEAD)
|
||||
kind load docker-image -n e2e quay.io/prometheus-operator/admission-webhook:$(git rev-parse --short HEAD)
|
||||
kubectl apply -f scripts/kind-rbac.yaml
|
||||
- name: Run tests
|
||||
run: >
|
||||
EXCLUDE_ALERTMANAGER_TESTS=exclude
|
||||
EXCLUDE_PROMETHEUS_TESTS=exclude
|
||||
EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude
|
||||
EXCLUDE_THANOSRULER_TESTS=exclude
|
||||
EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude
|
||||
EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude
|
||||
make test-e2e
|
7
.github/workflows/e2e.yaml
vendored
7
.github/workflows/e2e.yaml
vendored
|
@ -26,35 +26,30 @@ jobs:
|
|||
alertmanager: ""
|
||||
thanosruler: "exclude"
|
||||
operatorUpgrade: "exclude"
|
||||
featureGated: "include"
|
||||
- suite: prometheus
|
||||
prometheus: ""
|
||||
prometheusAllNS: "exclude"
|
||||
alertmanager: "exclude"
|
||||
thanosruler: "exclude"
|
||||
operatorUpgrade: "exclude"
|
||||
featureGated: "include"
|
||||
- suite: prometheusAllNS
|
||||
prometheus: "exclude"
|
||||
prometheusAllNS: ""
|
||||
alertmanager: "exclude"
|
||||
thanosruler: "exclude"
|
||||
operatorUpgrade: "exclude"
|
||||
featureGated: "include"
|
||||
- suite: thanosruler
|
||||
prometheus: "exclude"
|
||||
prometheusAllNS: "exclude"
|
||||
alertmanager: "exclude"
|
||||
thanosruler: ""
|
||||
operatorUpgrade: "exclude"
|
||||
featureGated: "include"
|
||||
- suite: operatorUpgrade
|
||||
prometheus: "exclude"
|
||||
prometheusAllNS: "exclude"
|
||||
alertmanager: "exclude"
|
||||
thanosruler: "exclude"
|
||||
operatorUpgrade: ""
|
||||
featureGated: "include"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Import environment variables from file
|
||||
|
@ -99,7 +94,7 @@ jobs:
|
|||
EXCLUDE_PROMETHEUS_ALL_NS_TESTS=${{ matrix.prometheusAllNS }}
|
||||
EXCLUDE_THANOSRULER_TESTS=${{ matrix.thanosruler }}
|
||||
EXCLUDE_OPERATOR_UPGRADE_TESTS=${{ matrix.operatorUpgrade }}
|
||||
FEATURE_GATED_TESTS=${{ matrix.featureGated }}
|
||||
EXCLUDE_FEATURE_GATED_TESTS=exclude
|
||||
EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude
|
||||
make test-e2e
|
||||
|
||||
|
|
|
@ -47,5 +47,5 @@ jobs:
|
|||
EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude
|
||||
EXCLUDE_THANOSRULER_TESTS=exclude
|
||||
EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude
|
||||
FEATURE_GATED_TESTS=exclude
|
||||
EXCLUDE_FEATURE_GATED_TESTS=exclude
|
||||
make test-e2e
|
||||
|
|
12
Makefile
12
Makefile
|
@ -366,27 +366,27 @@ test-e2e: test/instrumented-sample-app/certs/cert.pem test/instrumented-sample-a
|
|||
|
||||
.PHONY: test-e2e-alertmanager
|
||||
test-e2e-alertmanager:
|
||||
EXCLUDE_PROMETHEUS_TESTS=exclude EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude EXCLUDE_THANOSRULER_TESTS=exclude EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude FEATURE_GATED_TESTS=exclude EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
EXCLUDE_PROMETHEUS_TESTS=exclude EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude EXCLUDE_THANOSRULER_TESTS=exclude EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude EXCLUDE_FEATURE_GATED_TESTS=exclude EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
|
||||
.PHONY: test-e2e-prometheus
|
||||
test-e2e-prometheus:
|
||||
EXCLUDE_ALERTMANAGER_TESTS=exclude EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude EXCLUDE_THANOSRULER_TESTS=exclude EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude FEATURE_GATED_TESTS=exclude EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
EXCLUDE_ALERTMANAGER_TESTS=exclude EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude EXCLUDE_THANOSRULER_TESTS=exclude EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude EXCLUDE_FEATURE_GATED_TESTS=exclude EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
|
||||
.PHONY: test-e2e-prometheus-all-namespaces
|
||||
test-e2e-prometheus-all-namespaces:
|
||||
EXCLUDE_ALERTMANAGER_TESTS=exclude EXCLUDE_PROMETHEUS_TESTS=exclude EXCLUDE_THANOSRULER_TESTS=exclude EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude FEATURE_GATED_TESTS=exclude EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
EXCLUDE_ALERTMANAGER_TESTS=exclude EXCLUDE_PROMETHEUS_TESTS=exclude EXCLUDE_THANOSRULER_TESTS=exclude EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude EXCLUDE_FEATURE_GATED_TESTS=exclude EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
|
||||
.PHONY: test-e2e-thanos-ruler
|
||||
test-e2e-thanos-ruler:
|
||||
EXCLUDE_ALERTMANAGER_TESTS=exclude EXCLUDE_PROMETHEUS_TESTS=exclude EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude FEATURE_GATED_TESTS=exclude EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
EXCLUDE_ALERTMANAGER_TESTS=exclude EXCLUDE_PROMETHEUS_TESTS=exclude EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude EXCLUDE_FEATURE_GATED_TESTS=exclude EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
|
||||
.PHONY: test-e2e-operator-upgrade
|
||||
test-e2e-operator-upgrade:
|
||||
EXCLUDE_ALERTMANAGER_TESTS=exclude EXCLUDE_PROMETHEUS_TESTS=exclude EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude EXCLUDE_THANOSRULER_TESTS=exclude FEATURE_GATED_TESTS=exclude EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
EXCLUDE_ALERTMANAGER_TESTS=exclude EXCLUDE_PROMETHEUS_TESTS=exclude EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude EXCLUDE_THANOSRULER_TESTS=exclude EXCLUDE_FEATURE_GATED_TESTS=exclude EXCLUDE_PROMETHEUS_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
|
||||
.PHONY: test-e2e-prometheus-upgrade
|
||||
test-e2e-prometheus-upgrade:
|
||||
EXCLUDE_ALERTMANAGER_TESTS=exclude EXCLUDE_PROMETHEUS_TESTS=exclude EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude EXCLUDE_THANOSRULER_TESTS=exclude FEATURE_GATED_TESTS=exclude EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
EXCLUDE_ALERTMANAGER_TESTS=exclude EXCLUDE_PROMETHEUS_TESTS=exclude EXCLUDE_PROMETHEUS_ALL_NS_TESTS=exclude EXCLUDE_THANOSRULER_TESTS=exclude EXCLUDE_FEATURE_GATED_TESTS=exclude EXCLUDE_OPERATOR_UPGRADE_TESTS=exclude $(MAKE) test-e2e
|
||||
|
||||
.PHONY: test-e2e-images
|
||||
test-e2e-images: image
|
||||
|
|
|
@ -81,12 +81,8 @@ func skipAllNSTests(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// feature gated tests need to be explicitly included
|
||||
// not currently in use
|
||||
//
|
||||
// nolint:all
|
||||
func runFeatureGatedTests(t *testing.T) {
|
||||
if os.Getenv("FEATURE_GATED_TESTS") != "include" {
|
||||
func skipFeatureGatedTests(t *testing.T) {
|
||||
if os.Getenv("EXCLUDE_FEATURE_GATED_TESTS") != "" {
|
||||
t.Skip("Skipping Feature Gated tests")
|
||||
}
|
||||
}
|
||||
|
@ -420,6 +416,18 @@ const (
|
|||
prometheusOperatorServiceName = "prometheus-operator"
|
||||
)
|
||||
|
||||
// TestGatedFeatures tests features that are behind feature gates.
|
||||
func TestGatedFeatures(t *testing.T) {
|
||||
skipFeatureGatedTests(t)
|
||||
testFuncs := map[string]func(t *testing.T){
|
||||
// To be added.
|
||||
}
|
||||
|
||||
for name, f := range testFuncs {
|
||||
t.Run(name, f)
|
||||
}
|
||||
}
|
||||
|
||||
// TestPrometheusVersionUpgrade tests that all Prometheus versions in the compatibility matrix can be upgraded.
|
||||
func TestPrometheusVersionUpgrade(t *testing.T) {
|
||||
skipPromVersionUpgradeTests(t)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue