@@ -619,6 +619,7 @@ func TestUserWorkloadMonitorPrometheusK8Config(t *testing.T) {
619
619
datacenter: eu-west
620
620
remoteWrite:
621
621
- url: "https://test.remotewrite.com/api/write"
622
+ sendExemplars: true
622
623
volumeClaimTemplate:
623
624
spec:
624
625
resources:
@@ -687,6 +688,10 @@ func TestUserWorkloadMonitorPrometheusK8Config(t *testing.T) {
687
688
name : "assert query log file value is set and correct" ,
688
689
assertion : assertQueryLogValueEquals (f .UserWorkloadMonitoringNs , crName , "/tmp/test.log" ),
689
690
},
691
+ {
692
+ name : "assert exemplars are enabled" ,
693
+ assertion : assertExemplarsEnabled (f .UserWorkloadMonitoringNs ),
694
+ },
690
695
} {
691
696
t .Run (tc .name , tc .assertion )
692
697
}
@@ -1079,3 +1084,24 @@ func assertQueryLogValueEquals(namespace, crName, value string) func(t *testing.
1079
1084
}
1080
1085
}
1081
1086
}
1087
+
1088
+ func assertExemplarsEnabled (namespace string ) func (t * testing.T ) {
1089
+ return func (t * testing.T ) {
1090
+ err := framework .Poll (time .Second , time .Minute * 5 , func () error {
1091
+ prom , err := f .MonitoringClient .Prometheuses (namespace ).Get (context .Background (), "user-workload" , metav1.GetOptions {})
1092
+ if err != nil {
1093
+ t .Fatal ("failed to get required prometheus cr" , err )
1094
+ }
1095
+ exemplarStorageFeatureFlag := "exemplar-storage"
1096
+ for _ , enabledFeature := range prom .Spec .EnableFeatures {
1097
+ if enabledFeature == "exemplar-storage" {
1098
+ return nil
1099
+ }
1100
+ }
1101
+ return fmt .Errorf ("expected %s feature to be enabled" , exemplarStorageFeatureFlag )
1102
+ })
1103
+ if err != nil {
1104
+ t .Fatal (err )
1105
+ }
1106
+ }
1107
+ }
0 commit comments