Skip to content

Commit aae39e1

Browse files
committed
test: automation to cover nill resource selector
The auto covered upstream issue https://github.com/prometheus-operator/prometheus-operator/issue/6018
1 parent 828a2d8 commit aae39e1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/e2e/monitoring_stack_controller_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ func TestMonitoringStackController(t *testing.T) {
6666
}, {
6767
name: "resource selector nil propagates to Prometheus",
6868
scenario: nilResrouceSelectorPropagatesToPrometheus,
69+
}, {
70+
name: "prometheus with nil resource selector becomes ready",
71+
scenario: nilResourceSelectorPrometheusBecomesReady,
6972
}, {
7073
name: "stack spec are reflected in Prometheus",
7174
scenario: reconcileStack,
@@ -174,6 +177,21 @@ func nilResrouceSelectorPropagatesToPrometheus(t *testing.T) {
174177
}
175178
}
176179

180+
func nilResourceSelectorPrometheusBecomesReady(t *testing.T) {
181+
ms := newMonitoringStack(t, "nil-selector-ready")
182+
ms.Spec.ResourceSelector = nil
183+
184+
err := f.K8sClient.Create(context.Background(), ms)
185+
assert.NilError(t, err, "failed to create monitoring stack with nil resourceSelector")
186+
187+
// Verify Prometheus CR is created
188+
f.AssertResourceEventuallyExists(ms.Name, ms.Namespace, &monv1.Prometheus{})(t)
189+
190+
// Verify Prometheus pods become ready despite nil resourceSelector
191+
// covers upstream issue #932
192+
f.AssertStatefulsetReady("prometheus-"+ms.Name, ms.Namespace, framework.WithTimeout(5*time.Minute))(t)
193+
}
194+
177195
func promConfigDefaultsAreApplied(t *testing.T) {
178196
tests := []struct {
179197
name string

0 commit comments

Comments
 (0)