Skip to content

E2E: Fix tuned active profile check for wrapped performance profiles#1549

Open
mrniranjan wants to merge 1 commit into
openshift:mainfrom
mrniranjan:fix_tuned_profile
Open

E2E: Fix tuned active profile check for wrapped performance profiles#1549
mrniranjan wants to merge 1 commit into
openshift:mainfrom
mrniranjan:fix_tuned_profile

Conversation

@mrniranjan

@mrniranjan mrniranjan commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Test 37127 read /etc/tuned/active_profile on the node and expected the performance profile name. That fails when a higher-priority Tuned CR wraps the PP via include= (e.g. ran-du-performance), because the active profile name is the wrapper, not the PP name.

Detect wrapper profiles by scanning Tuned CRs for include= and assert Profile.status.tunedProfile via the API instead of pod exec.

Summary by CodeRabbit

  • Tests
    • Enhanced performance profile testing to better validate Tuned profile status across cluster nodes. Improved test logic to verify active profiles against cluster configuration resources and switched profile lookups to use control-plane infrastructure. Added helper functionality to determine expected active profile names.

Test 37127 read /etc/tuned/active_profile on the node and expected the
performance profile name. That fails when a higher-priority Tuned CR wraps
the PP via include=<pp-profile> (e.g. ran-du-performance), because the
active profile name is the wrapper, not the PP name.

Detect wrapper profiles by scanning Tuned CRs for include=<pp-profile>
and assert Profile.status.tunedProfile via the API instead of pod exec.

Signed-off-by: Niranjan M.R <mniranja@redhat.com>
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Walkthrough

A new helper expectedActiveProfileName(ctx) is added that scans all tunedv1.Tuned objects for wrapper profiles whose data contains include=<performanceProfileName>, returning the wrapper name or falling back to the base profile name. Both the active-profile and degraded-profile e2e checks are updated to use the control-plane client and this resolved name.

Changes

Tuned Profile Verification Rewrite

Layer / File(s) Summary
expectedActiveProfileName helper and active profile test rewrite
test/e2e/performanceprofile/functests/1_performance/performance.go
Adds expectedActiveProfileName(ctx) that lists tunedv1.Tuned objects and returns the wrapper profile name when include=<performanceProfileName> is found in profile data, otherwise the base name. The active profile test is rewritten to query tunedv1.Profile status from the control plane and assert against the computed name.
Client switch for degraded profile check
test/e2e/performanceprofile/functests/1_performance/performance.go
Switches the Tuned profile fetch in the "shouldn't be degraded" assertion from testclient.DataPlaneClient to testclient.ControlPlaneClient.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 13 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ⚠️ Warning Two assertions lack meaningful failure messages: line 122 (g.Expect(...Get(...)).To(Succeed())) and line 1429 (Expect(...List(...)).To(Succeed())), violating the assertion messages requirement. Add failure messages to both assertions (e.g., "failed to get Tuned profile for node" and "failed to list Tuned profiles") to help diagnose failures, following the codebase pattern.
✅ Passed checks (13 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing the E2E test for tuned active profile validation when performance profiles are wrapped by other Tuned CRs.
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 Both modified test titles are static and deterministic with no dynamic content. Node names appear only in By() statements in test bodies, following Ginkgo best practices.
Microshift Test Compatibility ✅ Passed PR rewrites existing tests, not adding new Ginkgo e2e tests; custom check applies only to newly added tests.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR adds a new performance.go test file with multiple Ginkgo e2e tests. All tests iterate over workerRTNodes with patterns like for _, node := range workerRTNodes, which work correctly on SNO...
Topology-Aware Scheduling Compatibility ✅ Passed Pull request modifies only a test file (test/e2e/...), not deployment manifests, operator code, or controllers. The custom check scope explicitly applies only to such changes.
Ote Binary Stdout Contract ✅ Passed The new code (expectedActiveProfileName function and its usage) writes to ginkgo.GinkgoWriter via testlog package, not to stdout. The function is marked with GinkgoHelper() and called only from wit...
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR modifies existing tests, not new ones. The changes replace pod exec with K8s API calls, eliminating external dependencies. No IPv4 addresses, external URLs, or connectivity requirements dete...
No-Weak-Crypto ✅ Passed PR modifies a Kubernetes test file with no cryptographic operations - only test logic for validating Tuned profiles using string matching and API queries.
Container-Privileges ✅ Passed Privileged containers in tuned DaemonSet are justified: system-level kernel/module tuning requires hostPID, hostNetwork, hostIPC access with clear documentation.
No-Sensitive-Data-In-Logs ✅ Passed All 11 logging statements added in the PR log only non-sensitive data (Kubernetes object names, CPU masks, node names, and system configuration). No passwords, tokens, API keys, PII, or other sensi...

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="Running error: context loading failed: failed to load packages: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: inconsistent vendoring in :\n\tgithub.com/RHsyseng/operator-utils@v1.4.13: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/coreos/go-systemd@v0.0.0-20191104093116-d3cd4ed1dbcf: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/coreos/ignition@v0.35.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/coreos/ignition/v2@v2.26.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/docker/go-units@v0.5.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/go-logr/stdr@v1.2.2: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/google/go-cmp@v0.7.0

... [truncated 19340 characters] ...

is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/legacy-cloud-providers: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/metrics: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/mount-utils: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/pod-security-admission: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/sample-apiserver: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tgithub.com/onsi/ginkgo/v2: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\n\tTo ignore the vendor directory, use -mod=readonly or -mod=mod.\n\tTo sync the vendor directory, run:\n\t\tgo mod vendor\n"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci openshift-ci Bot requested review from ffromani and jmencak June 18, 2026 12:51
@openshift-ci

openshift-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mrniranjan
Once this PR has been reviewed and has the lgtm label, please assign yanirq for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/performanceprofile/functests/1_performance/performance.go`:
- Around line 1430-1439: The loop that returns the first profile containing
include=<performanceProfileName> does not account for Tuned recommendation
semantics and can return an incorrect profile when multiple Tuned CRs include
the performance profile. Instead of returning on the first include= match found
via strings.Contains, resolve the wrapper profile by consulting Tuned's
recommendation selection logic (priority and match criteria) to identify the
active/effective recommended profile. Alternatively, detect when multiple
candidate profiles exist that contain the include match and fail fast with a
clear error rather than returning an ambiguous result.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ee8fdbda-b6f7-416d-a49b-3d1cfb261e56

📥 Commits

Reviewing files that changed from the base of the PR and between 8978bc5 and 6cd6d9d.

📒 Files selected for processing (1)
  • test/e2e/performanceprofile/functests/1_performance/performance.go

Comment on lines +1430 to +1439
for _, tuned := range tunedList.Items {
for _, profile := range tuned.Spec.Profile {
if profile.Data == nil || profile.Name == nil {
continue
}

if strings.Contains(*profile.Data, fmt.Sprintf("include=%s", performanceProfileName)) {
testlog.Warningf("performance profile is wrapped by Tuned CR profile %q (profile: %q)", tuned.Name, *profile.Name)
return *profile.Name
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Resolve active wrapper via recommendation semantics, not first include= hit.

Line 1430-Line 1439 returns the first profile whose data contains include=<performanceProfileName>. This can select the wrong expected profile when multiple Tuned CRs include the performance profile (or include it but are not the effective/highest-priority recommended profile), causing nondeterministic test outcomes.

Please resolve against Tuned recommendation selection (priority/match) before returning a wrapper profile name, or fail fast when multiple include-matches exist and cannot be disambiguated.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/performanceprofile/functests/1_performance/performance.go` around
lines 1430 - 1439, The loop that returns the first profile containing
include=<performanceProfileName> does not account for Tuned recommendation
semantics and can return an incorrect profile when multiple Tuned CRs include
the performance profile. Instead of returning on the first include= match found
via strings.Contains, resolve the wrapper profile by consulting Tuned's
recommendation selection logic (priority and match criteria) to identify the
active/effective recommended profile. Alternatively, detect when multiple
candidate profiles exist that contain the include match and fail fast with a
clear error rather than returning an ambiguous result.

@mrniranjan

Copy link
Copy Markdown
Contributor Author

/retest-required

@openshift-ci

openshift-ci Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@mrniranjan: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn 6cd6d9d link true /test e2e-aws-ovn
ci/prow/e2e-upgrade 6cd6d9d link true /test e2e-upgrade
ci/prow/e2e-hypershift-pao 6cd6d9d link true /test e2e-hypershift-pao

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

Sign up for free to 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.

1 participant