Skip to content

Commit 3d6c61f

Browse files
Merge pull request #2543 from machine424/coco3
NO-JIRA: fix TestPrometheusRemoteWrite to align the image used for th…
2 parents 67ef637 + a330c07 commit 3d6c61f

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

test/e2e/framework/prometheus.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
"k8s.io/apimachinery/pkg/util/intstr"
3333
)
3434

35-
func (f Framework) MakePrometheusWithWebTLSRemoteReceive(name, tlsSecretName string) *monitoringv1.Prometheus {
35+
func (f Framework) MakePrometheusWithWebTLSRemoteReceive(name, tlsSecretName string, image *string) *monitoringv1.Prometheus {
3636
// This is not required in the Prometheus spec, but we inspect that value in
3737
// WaitForPrometheus. Omitting it causes this code to derefence a nil.
3838
replicas := int32(1)
@@ -47,10 +47,11 @@ func (f Framework) MakePrometheusWithWebTLSRemoteReceive(name, tlsSecretName str
4747
},
4848
Spec: monitoringv1.PrometheusSpec{
4949
CommonPrometheusFields: monitoringv1.CommonPrometheusFields{
50-
Replicas: &replicas,
51-
ServiceAccountName: "prometheus-k8s",
52-
Secrets: []string{tlsSecretName},
53-
EnableFeatures: []monitoringv1.EnableFeature{"remote-write-receiver"},
50+
Image: image,
51+
Replicas: &replicas,
52+
ServiceAccountName: "prometheus-k8s",
53+
Secrets: []string{tlsSecretName},
54+
EnableRemoteWriteReceiver: true,
5455
Web: &monitoringv1.PrometheusWebSpec{
5556
WebConfigFileFields: monitoringv1.WebConfigFileFields{
5657
TLSConfig: &monitoringv1.WebTLSConfig{

test/e2e/prometheus_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ type remoteWriteTest struct {
123123
func TestPrometheusRemoteWrite(t *testing.T) {
124124
ctx := context.Background()
125125

126+
// Use the same image than k8s' for the remote write target.
127+
k8sProm, err := f.MonitoringClient.Prometheuses(f.Ns).Get(ctx, "k8s", metav1.GetOptions{})
128+
if err != nil {
129+
t.Fatal(err)
130+
}
131+
image := k8sProm.Spec.Image
132+
126133
name := "rwe2e"
127134

128135
// deploy a service for our remote write target
@@ -291,7 +298,7 @@ func TestPrometheusRemoteWrite(t *testing.T) {
291298

292299
t.Run(tc.name, func(t *testing.T) {
293300
// deploy remote write target
294-
prometheusReceiver := f.MakePrometheusWithWebTLSRemoteReceive(name, secName)
301+
prometheusReceiver := f.MakePrometheusWithWebTLSRemoteReceive(name, secName, image)
295302
if err := f.OperatorClient.CreateOrUpdatePrometheus(ctx, prometheusReceiver); err != nil {
296303
t.Fatal(err)
297304
}

0 commit comments

Comments
 (0)