Skip to content

Commit

Permalink
(e2e) Reduce Consistently time for catalogsource_ready metrics check (#…
Browse files Browse the repository at this point in the history
…2739)

This test was checking for the catalogsource_ready metrics being emitted
with a particular value, consistently for a period of time. `Consistently`
blocks for the duration of time mentioned (previously 3m). Unfortunately,
there is no way to write an `Eventually` that starts polling after an
interval, which could have been the non-blocking alternatve to using
Consistently to perform the same check.

This PR reduces the period of time the test is blocked Consistently to
1m, to reduce the test package's overall runtime.

Ref:
https://onsi.github.io/gomega/#eventually
https://onsi.github.io/gomega/#consistently
Signed-off-by: Anik Bhattacharjee <anikbhattacharya93@gmail.com>
  • Loading branch information
anik120 committed Apr 28, 2022
1 parent d505efc commit 210b834
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/e2e/metrics_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ var _ = Describe("Metrics are generated for OLM managed resources", func() {
AfterEach(func() {
cleanup()
})
It("emits metrics for the catalogSource", func() {
It("emits catalogsource_ready metric for the catalogSource with Value equal to 1", func() {
Eventually(func() []Metric {
return getMetricsFromPod(c, getPodWithLabel(c, "app=catalog-operator"))
}).Should(And(
Expand Down Expand Up @@ -412,7 +412,7 @@ var _ = Describe("Metrics are generated for OLM managed resources", func() {
AfterEach(func() {
cleanup()
})
It("emits metrics for the CatlogSource with a Value greater than 0", func() {
It("emits metrics for the CatlogSource with a Value equal to 0", func() {
Eventually(func() []Metric {
return getMetricsFromPod(c, getPodWithLabel(c, "app=catalog-operator"))
}).Should(And(
Expand All @@ -425,7 +425,7 @@ var _ = Describe("Metrics are generated for OLM managed resources", func() {
))
Consistently(func() []Metric {
return getMetricsFromPod(c, getPodWithLabel(c, "app=catalog-operator"))
}, "3m").Should(And(
}, "1m", "30s").Should(And(
ContainElement(LikeMetric(
WithFamily("catalogsource_ready"),
WithName(name),
Expand Down

0 comments on commit 210b834

Please sign in to comment.