Skip to content

🐛 Client go version metrics endpoint test - #1821

Merged
joelanford merged 9 commits into
operator-framework:mainfrom
bentito:client-go-version-metrics-endpoint-test
Mar 5, 2025
Merged

🐛 Client go version metrics endpoint test#1821
joelanford merged 9 commits into
operator-framework:mainfrom
bentito:client-go-version-metrics-endpoint-test

Conversation

@bentito

Copy link
Copy Markdown
Contributor

Description

This PR rewrites the metrics endpoint e2e test using client-go. It maintains the recent change to the kubectl exec version by still "force" deleting the Pod (0 time grace period). Seems to pass a local 10 of 10 in a row e2e test.

Added an optional TEST_FILTER env var to the e2e run in the Makefile. Not really related but sure is better when you're iterating on one e2e test change.

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@openshift-merge-robotopenshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 27, 2025
@bentito
bentito requested a review from a team as a code ownerFebruary 27, 2025 19:10
@netlify

netlifyBot commented Feb 27, 2025

Copy link
Copy Markdown

Deploy Preview for olmv1 ready!

NameLink
🔨 Latest commit600fb09
🔍 Latest deploy loghttps://app.netlify.com/sites/olmv1/deploys/67c89a75fb9fcd00089a5ff7
😎 Deploy Previewhttps://deploy-preview-1821--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bentito
bentitoforce-pushed the client-go-version-metrics-endpoint-test branch from ecfef0f to dce13b3CompareFebruary 27, 2025 19:26
@openshift-merge-robotopenshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 27, 2025
@bentito

Copy link
Copy Markdown
ContributorAuthor

Hmm, I pulled test/utils.go because I thought it had no used methods once I moved FindK8sClient to the test file and made it local. There was another seemingly unused, but now I'm realizing possibly externally used function there. Should I just put utils.go back as-was to alleviate the go-apidiff check fail, or...?

@codecov

codecovBot commented Feb 27, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.45%. Comparing base (7fc18c6) to head (600fb09).
Report is 1 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #1821 +/- ##
==========================================
+ Coverage 68.39% 68.45% +0.05% 
==========================================
Files 63 63 Lines 5136 5136 ==========================================
+ Hits 3513 3516 +3 + Misses 1392 1390 -2 + Partials 231 230 -1 
FlagCoverage Δ
e2e51.60% <ø> (+0.07%)⬆️
unit55.99% <ø> (-0.02%)⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment threadMakefile
Comment threadtest/e2e/metrics_test.go Outdated
require.Contains(c.t, string(output), "200 OK", "Metrics endpoint did not return 200 OK")
// Combine stdout + stderr
combined := stdout.String() + stderr.String()
require.Contains(c.t, combined, "200 OK", "Metrics endpoint did not return 200 OK")

@camilamacedo86camilamacedo86Feb 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not much more complex than before?
I think before it was very clear what it does, we could easily copy and paste to validate the things.
But anyone, maybe it is a matter of preference. So, OK with ANY

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah Idk, it was certainly harder to implement, kubectl exec was doing several things for us. I think this PR mostly just answers @joelanford concern that that help from kubectl also opened more avenues for things to go subtly wrong. And @azych desire that this test should use go-client like the other e2e.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see wrapping this in a more general purpose execInPod kind of utility function that could be re-used. But mostly a nit since there's not another place that we need this at the moment.

Comment threadtest/e2e/metrics_test.go
Comment threadtest/e2e/metrics_test.go Outdated
Comment threadtest/e2e/metrics_test.go Outdated
Comment threadtest/e2e/metrics_test.go Outdated
Comment threadtest/e2e/metrics_test.go

@azychazych left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just added a few nits

Comment threadtest/e2e/metrics_test.go
Comment threadMakefile Outdated
@openshift-merge-robotopenshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 3, 2025
@bentito
bentitoforce-pushed the client-go-version-metrics-endpoint-test branch from 8f5b7eb to 15a1c2aCompareMarch 3, 2025 21:53
@openshift-merge-robotopenshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 3, 2025
Signed-off-by: Brett Tofel <btofel@redhat.com>
test/utils.go deleted because no used funcs
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Have to have package filter too, to not run all the unit tests due to UNIT_TEST_DIRS
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
@bentito
bentitoforce-pushed the client-go-version-metrics-endpoint-test branch from 15a1c2a to e82ebcaCompareMarch 5, 2025 13:39
Comment threadMakefile Outdated
Signed-off-by: Brett Tofel <btofel@redhat.com>
@joelanford
joelanford enabled auto-merge March 5, 2025 20:22
@joelanford
joelanford added this pull request to the merge queue Mar 5, 2025
Merged via the queue into operator-framework:main with commit fed0ad5Mar 5, 2025
camilamacedo86 added a commit that referenced this pull request Mar 18, 2025
github-merge-queueBot pushed a commit that referenced this pull request Mar 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@bentito@joelanford@perdasilva@LalatenduMohanty@azych@camilamacedo86@openshift-merge-robot