Skip to content

Commit

Permalink
Merge pull request #2194 from machine424/test-io
Browse files Browse the repository at this point in the history
MON-3589: Refactor assertExemplarsEnabled check for UWM Prometheus xand add a check for --scrape.timestamp-tolerance on Platform Prometheus
  • Loading branch information
openshift-merge-bot[bot] committed Dec 20, 2023
2 parents 0e876ff + 2b8190d commit b80fa8a
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions test/e2e/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ func TestClusterMonitorPrometheusK8Config(t *testing.T) {
[]framework.PodAssertion{
expectCatchAllToleration(),
expectMatchingRequests(podName, containerName, mem, cpu),
// Set by default.
expectContainerArg("--scrape.timestamp-tolerance=15ms", containerName),
// Set via the config above.
expectContainerArg("--log.level=debug", containerName),
expectContainerArg("--storage.tsdb.retention.time=10h", containerName),
expectContainerArg("--storage.tsdb.retention.size=15GB", containerName),
Expand Down Expand Up @@ -650,6 +653,9 @@ func TestUserWorkloadMonitorPrometheusK8Config(t *testing.T) {
[]framework.PodAssertion{
expectCatchAllToleration(),
expectMatchingRequests(podName, containerName, mem, cpu),
// Set by default.
expectContainerArg("--enable-feature=exemplar-storage", containerName),
// Set via the config above.
expectContainerArg("--log.level=debug", containerName),
expectContainerArg("--storage.tsdb.retention.time=10h", containerName),
expectContainerArg("--storage.tsdb.retention.size=15GB", containerName),
Expand Down Expand Up @@ -688,10 +694,6 @@ func TestUserWorkloadMonitorPrometheusK8Config(t *testing.T) {
name: "assert query log file value is set and correct",
assertion: assertQueryLogValueEquals(f.UserWorkloadMonitoringNs, crName, "/tmp/test.log"),
},
{
name: "assert exemplars are enabled",
assertion: assertExemplarsEnabled(f.UserWorkloadMonitoringNs),
},
} {
t.Run(tc.name, tc.assertion)
}
Expand Down Expand Up @@ -1084,24 +1086,3 @@ func assertQueryLogValueEquals(namespace, crName, value string) func(t *testing.
}
}
}

func assertExemplarsEnabled(namespace string) func(t *testing.T) {
return func(t *testing.T) {
err := framework.Poll(time.Second, time.Minute*5, func() error {
prom, err := f.MonitoringClient.Prometheuses(namespace).Get(context.Background(), "user-workload", metav1.GetOptions{})
if err != nil {
t.Fatal("failed to get required prometheus cr", err)
}
exemplarStorageFeatureFlag := "exemplar-storage"
for _, enabledFeature := range prom.Spec.EnableFeatures {
if enabledFeature == "exemplar-storage" {
return nil
}
}
return fmt.Errorf("expected %s feature to be enabled", exemplarStorageFeatureFlag)
})
if err != nil {
t.Fatal(err)
}
}
}

0 comments on commit b80fa8a

Please sign in to comment.