Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit ff66684

Browse files
committed
test: Ginkgo and Gomega update
The new Gomega version supports testing a function with no return value (onsi/gomega#198 (comment)). This makes it possible to simplify the metrics test.
1 parent cf76839 commit ff66684

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/kubernetes-csi/csi-test/v4 v4.2.0
1515
github.com/miekg/dns v1.1.38 // indirect
1616
github.com/onsi/ginkgo v1.16.4
17-
github.com/onsi/gomega v1.13.0
17+
github.com/onsi/gomega v1.13.1-0.20210610024953-2f04e6e3467d
1818
github.com/operator-framework/operator-lib v0.4.0
1919
github.com/prometheus/client_golang v1.11.0
2020
github.com/prometheus/client_model v0.2.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,8 @@ github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
522522
github.com/onsi/gomega v1.10.4/go.mod h1:g/HbgYopi++010VEqkFgJHKC09uJiW9UkXvMUuKHUCQ=
523523
github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak=
524524
github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY=
525+
github.com/onsi/gomega v1.13.1-0.20210610024953-2f04e6e3467d h1:xP4paM8h3wbI0mhcjOZeeRNI2HzqxIgKSMJv+brTHaE=
526+
github.com/onsi/gomega v1.13.1-0.20210610024953-2f04e6e3467d/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY=
525527
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
526528
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
527529
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=

test/e2e/metrics/metrics.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,6 @@ var _ = deploy.Describe("direct-testing", "direct-testing-metrics", "", func(d *
7878
pod.Namespace, pod.Name, port.ContainerPort)
7979
resp, err := client.Get(url)
8080
framework.ExpectNoError(err, "GET failed")
81-
// When wrapped with InterceptGomegaFailures, err == nil doesn't
82-
// cause the function to abort. We have to do that ourselves before
83-
// using resp to avoid a panic.
84-
// https://github.com/onsi/gomega/issues/198#issuecomment-856630787
85-
if err != nil {
86-
return
87-
}
8881
data, err := ioutil.ReadAll(resp.Body)
8982
framework.ExpectNoError(err, "read GET response")
9083
name := pod.Name + "/" + container.Name
@@ -109,9 +102,7 @@ var _ = deploy.Describe("direct-testing", "direct-testing-metrics", "", func(d *
109102
}
110103
Expect(numPods).NotTo(Equal(0), "at least one container should have a 'metrics' port")
111104
}
112-
Eventually(func() string {
113-
return strings.Join(InterceptGomegaFailures(test), "\n")
114-
}, "10s", "1s").Should(BeEmpty())
105+
Eventually(test, "10s", "1s").Should(Succeed())
115106
})
116107

117108
It("rejects large headers", func() {

0 commit comments

Comments
 (0)