-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ (go/v4) Add Metrics Validation and Helper Functions to E2E Tests #4124
✨ (go/v4) Add Metrics Validation and Helper Functions to E2E Tests #4124
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
db3877e
to
331bac7
Compare
331bac7
to
82baf26
Compare
/hold |
8f6e1f0
to
69c1d84
Compare
69c1d84
to
66c6b1a
Compare
66c6b1a
to
94633cc
Compare
94633cc
to
1a4cd8e
Compare
a9b1d9c
to
d714031
Compare
With this one I think we can address all. |
/hold false It seems great to fly 🚀 |
pkg/plugins/golang/v4/scaffolds/internal/templates/test/e2e/suite.go
Outdated
Show resolved
Hide resolved
ExpectWithOffset(2, token).NotTo(BeEmpty()) | ||
|
||
By("waiting for the metrics endpoint to be ready") | ||
verifyMetricsEndpointReady := func() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually funcs can take a Gomega
parameter, which you can then use to verify, instead of returning an error.
verifyMetricsEndpointReady := func(g Gomega) {
cmd := exec.Command("kubectl", "get", "endpoints", metricsServiceName, "-n", namespace)
g.Expect(utils.Run(cmd)).To(ContainSubstring("8443"))
})
Eventually(verifyMetricsEndpointReady).WithTimeout(...).Should(Succeed())
you shouldn't need the WithOffset(2), and the whole test is somewhat more condensed, since it's not mixing the go error handling with Expect
ations.
g.Expect()
in the snippet above both should check the error be nil and the contents of the output string (not 100% sure about the type conversion from []byte to string, though).
Provide further improvements for e2e tests test to help users be aware of how to tests using the metrics endpoint and validate if the metrics are properly expose.
5d772aa
to
f867ac0
Compare
/lgtm (not that I think I have a say in the matter 😄) |
@mogsie: changing LGTM is restricted to collaborators In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Provide further improvements for e2e tests test to help users be aware of how to tests using the metrics endpoint and validate if the metrics are properly expose. Furthermore, shows how to use it to validate the reconciliation.
Partially closes: #4120