@@ -237,6 +237,7 @@ func TestClusterMonitorPrometheusK8Config(t *testing.T) {
237
237
data := fmt .Sprintf (`prometheusK8s:
238
238
logLevel: debug
239
239
retention: 10h
240
+ queryLogFile: /tmp/test.log
240
241
tolerations:
241
242
- operator: "Exists"
242
243
externalLabels:
@@ -294,6 +295,10 @@ func TestClusterMonitorPrometheusK8Config(t *testing.T) {
294
295
name : "assert remote write url value in set in CR" ,
295
296
f : assertRemoteWriteWasSet (f .Ns , crName , "https://test.remotewrite.com/api/write" ),
296
297
},
298
+ {
299
+ name : "assert query log file value is set and correct" ,
300
+ f : assertQueryLogWasSet (f .Ns , crName , "/tmp/test.log" ),
301
+ },
297
302
{
298
303
name : "assert rule for Thanos sidecar exists" ,
299
304
f : f .AssertPrometheusRuleExists (thanosRule , f .Ns ),
@@ -730,6 +735,7 @@ func TestUserWorkloadMonitorPrometheusK8Config(t *testing.T) {
730
735
"config.yaml" : fmt .Sprintf (`prometheus:
731
736
logLevel: debug
732
737
retention: 10h
738
+ queryLogFile: /tmp/test.log
733
739
tolerations:
734
740
- operator: "Exists"
735
741
externalLabels:
@@ -794,6 +800,10 @@ func TestUserWorkloadMonitorPrometheusK8Config(t *testing.T) {
794
800
name : "assert remote write url value in set in CR" ,
795
801
f : assertRemoteWriteWasSet (f .UserWorkloadMonitoringNs , crName , "https://test.remotewrite.com/api/write" ),
796
802
},
803
+ {
804
+ name : "assert query log file value is set and correct" ,
805
+ f : assertQueryLogWasSet (f .UserWorkloadMonitoringNs , crName , "/tmp/test.log" ),
806
+ },
797
807
} {
798
808
t .Run (scenario .name , scenario .f )
799
809
}
@@ -1110,3 +1120,22 @@ func assertRemoteWriteWasSet(namespace, crName, urlValue string) func(t *testing
1110
1120
}
1111
1121
}
1112
1122
}
1123
+
1124
+ func assertQueryLogWasSet (namespace , crName , value string ) func (t * testing.T ) {
1125
+ return func (t * testing.T ) {
1126
+ err := framework .Poll (time .Second , time .Minute * 5 , func () error {
1127
+ prom , err := f .MonitoringClient .Prometheuses (namespace ).Get (context .Background (), crName , metav1.GetOptions {})
1128
+ if err != nil {
1129
+ t .Fatal ("failed to get required prometheus cr" , err )
1130
+ }
1131
+
1132
+ if prom .Spec .QueryLogFile != value {
1133
+ return fmt .Errorf ("expected query log file value not found" )
1134
+ }
1135
+ return nil
1136
+ })
1137
+ if err != nil {
1138
+ t .Fatal (err )
1139
+ }
1140
+ }
1141
+ }
0 commit comments