Skip to content

Cherry-pick upstream PR #528: retire metrics-proxy self-test#2045

Open
alebedev87 wants to merge 2 commits into
openshift:mainfrom
alebedev87:cherry-pick-upstream-528
Open

Cherry-pick upstream PR #528: retire metrics-proxy self-test#2045
alebedev87 wants to merge 2 commits into
openshift:mainfrom
alebedev87:cherry-pick-upstream-528

Conversation

@alebedev87

@alebedev87 alebedev87 commented Jun 26, 2026

Copy link
Copy Markdown

Summary

Cherry-pick upstream #528 to fix the podExec duplicate symbol introduced by #2037. PR #2037 cherry-picked upstream PRs #530 and #536, which depend on #528 having removed metrics_test.go first. Without this, integration tests fail to compile due to podExec being declared in both common.go and metrics_test.go.

Failed pipeline which caught the missing PR#528 cherry-pick: link.
Successful pipeline with this PR: link.

Upstream PRs included

  • #528 Retire metrics-proxy self-test and its integration test

Summary by CodeRabbit

  • Chores

    • Removed an unused command-line self-test mode and related test code.
    • Cleaned up supporting imports and integration test helpers to match current usage.
  • Tests

    • Removed an integration test that exercised metrics collection through a self-test workflow.

frobware added 2 commits June 26, 2026 10:21
The /metrics-proxy test subcommand exists solely to be kubectl exec'd
by an integration test that has now been retired. Delete the
argv[1] == "test" dispatcher and all the code it reached:
runSelfTests, testHealthEndpoint, testMetricsEndpoint,
getServerCertPool, outputResults, and the TestResult/TestResults JSON
types.

The self-test's TLS verification was theatre. It dialled
localhost:8443 with InsecureSkipVerify: true, scraped the peer cert,
built a RootCAs pool, then performed the real request with
InsecureSkipVerify: false. The bootstrap dial trusted whatever
certificate the peer presented, so the subsequent "verified" call
only confirmed that the second peer matched the first. If the
bootstrap failed the code fell back silently to InsecureSkipVerify:
true.

See bpfman#527.

Signed-off-by: Andrew McDermott <amcdermo@redhat.com>
The metrics-proxy self-test driver in test/integration/metrics_test.go
never runs in upstream CI. The nightly KIND cluster does not install
the prometheus-operator CRDs, so monitoring.coreos.com is absent. The
bpfman-operator gates its metrics-proxy DaemonSet reconcile on that
API group (controllers/bpfman-operator/config.go:328) and the test
guards itself with the same check, hitting t.Skip on every nightly
run.

Delete metrics_test.go and move its podExec helper to common.go,
which also uses podExec for link-ordering checks. The rest of the
test file -- ServiceAccount/token plumbing, pod selector,
agentMetricTestResult JSON types -- goes with the file.

See bpfman#527.

Signed-off-by: Andrew McDermott <amcdermo@redhat.com>
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Walkthrough

The PR removes the metrics-proxy CLI self-test path and deletes the integration test that exercised it. The remaining metrics-proxy code and integration test helpers are updated to match the new layout.

Changes

Metrics proxy self-test cleanup

Layer / File(s) Summary
Remove self-test path
cmd/metrics-proxy/main.go, test/integration/metrics_test.go
The metrics-proxy test CLI branch and self-test implementation are removed, and the integration test that ran the self-test command is deleted.
Update integration helpers
test/integration/common.go
The integration helper import block adds context and k8s.io/api/core/v1 to match existing helper usage.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Ote Binary Stdout Contract ❌ Error main() still does fmt.Println(version.String()), and TestMain prints INFO lines to stdout; both violate the process-level stdout contract. Redirect those messages to stderr/GinkgoWriter, or remove stdout writes from main/TestMain entirely.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: retiring the metrics-proxy self-test and its integration test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Touched files add/remove no Ginkgo titles; common.go only imports, and main.go has no test declarations.
Test Structure And Quality ✅ Passed The PR removes the Ginkgo integration test file and only adds imports in common.go; no new It blocks or cluster-wait logic are introduced.
Microshift Test Compatibility ✅ Passed PR is deletions-only: it removes the metrics-proxy self-test and metrics_test.go; no new Ginkgo tests or MicroShift-unsupported APIs were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the patch only removes metrics_test.go and self-test code, so there are no new SNO multi-node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed Only test/self-test code was removed and imports adjusted; no manifests, controllers, node selectors, affinity, tolerations, or PDBs changed.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the PR deletes metrics_test.go and adds no IPv4-only or external-connectivity test code.
No-Weak-Crypto ✅ Passed No weak crypto or insecure secret comparisons are present in the touched files; the only crypto import is crypto/tls.
Container-Privileges ✅ Passed The PR only changes Go/test files; no manifest security-context settings like privileged/hostNetwork/allowPrivilegeEscalation appear in the touched files.
No-Sensitive-Data-In-Logs ✅ Passed No new sensitive logging was added; the only logging changes are in the deleted test file, and they don't print token contents.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot requested review from Billy99 and dave-tucker June 26, 2026 08:44
@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alebedev87

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants