Skip to content

Commit

Permalink
Merge pull request #592 from raptorsun/long-timeout-prometheus-poll
Browse files Browse the repository at this point in the history
OLS-1333 test: increase prometheus query timeout to 95s
  • Loading branch information
openshift-merge-bot[bot] authored Jan 17, 2025
2 parents 2588193 + 3dabda2 commit ae3920b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/e2e/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var _ = Describe("Prometheus Metrics", Ordered, func() {

It("should have operator metrics in Prometheus", func() {
By("verify Prometheus is working correctly by querying prometheus' own metrics")
err = prometheusClient.WaitForQueryReturnGreaterEqualOne("topk(1,prometheus_build_info)", DefaultClientTimeout)
err = prometheusClient.WaitForQueryReturnGreaterEqualOne("topk(1,prometheus_build_info)", DefaultPrometheusQueryTimeout)
Expect(err).NotTo(HaveOccurred())

By("verify prometheus scrapes metrics from operator, this should happen every 60 seconds")
Expand All @@ -105,7 +105,7 @@ var _ = Describe("Prometheus Metrics", Ordered, func() {
Expect(err).NotTo(HaveOccurred())

By("fetching the operator metrics from Prometheus")
err = prometheusClient.WaitForQueryReturnGreaterEqualOne("count(controller_runtime_reconcile_total{namespace=\"openshift-lightspeed\"})", DefaultClientTimeout)
err = prometheusClient.WaitForQueryReturnGreaterEqualOne("count(controller_runtime_reconcile_total{namespace=\"openshift-lightspeed\"})", DefaultPrometheusQueryTimeout)
Expect(err).NotTo(HaveOccurred())
})

Expand Down
4 changes: 4 additions & 0 deletions test/e2e/prometheus_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ type PrometheusClient struct {
rt http.RoundTripper
}

// DefaultPollInterval is the default interval for polling Prometheus metrics.
// Prometheus metrics are typically scraped every 30 seconds. This is enough for 3 scrapes.
const DefaultPrometheusQueryTimeout = 95 * time.Second

// NewPrometheusClientFromRoute creates and returns a new PrometheusClient from the given OpenShift route.
func NewPrometheusClientFromRoute(
ctx context.Context,
Expand Down

0 comments on commit ae3920b

Please sign in to comment.