Skip to content

HIVE-3148: Adding TEST_TAG so we can group/filter tests #2914

Merged
openshift-merge-bot[bot] merged 2 commits into
openshift:masterfrom
miyadav:hcmtestfilters-tag
May 29, 2026
Merged

HIVE-3148: Adding TEST_TAG so we can group/filter tests #2914
openshift-merge-bot[bot] merged 2 commits into
openshift:masterfrom
miyadav:hcmtestfilters-tag

Conversation

@miyadav
Copy link
Copy Markdown
Member

@miyadav miyadav commented May 28, 2026

By introducing TEST_TAG as an environment variable in the release CI configuration, we can group and selectively run Hive tests. This removes the dependency on the private repo for test execution. Instead, periodic jobs in the openshift/release repo can be configured to run Hive tests based on tags, enabling better test organization and scalability (including sharding if needed).

This PR also ensures that when deploying Hive via $IMG from the latest commit in the release repo, the Hive operator version is not unintentionally updated. This behavior was already validated earlier through a merged PR in the private repository.

With this change, most private-repo-based test cases can be deprecated, as periodic jobs in the release repo will handle coverage going forward. A working validation using a fork and PR (example) confirms that tests can be filtered using TEST_TAG (e.g., export TEST_TAG=HiveSDRosa) and executed .
Co-authored: Claude

Summary by CodeRabbit

  • Tests

    • Added environment-driven test selection capability for enhanced test filtering.
  • Chores

    • Improved deployment initialization with existence verification logic to optimize operator setup.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 28, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 28, 2026

@miyadav: This pull request references HIVE-3148 which is a valid jira issue.

Details

In response to this:

By introducing TEST_TAG as an environment variable in the release CI configuration, we can group and selectively run Hive tests. This removes the dependency on the private repo for test execution. Instead, periodic jobs in the openshift/release repo can be configured to run Hive tests based on tags, enabling better test organization and scalability (including sharding if needed).

This PR also ensures that when deploying Hive via $IMG from the latest commit in the release repo, the Hive operator version is not unintentionally updated. This behavior was already validated earlier through a merged PR in the private repository.

With this change, most private-repo-based test cases can be deprecated, as periodic jobs in the release repo will handle coverage going forward. A working validation using a fork and PR (example) confirms that tests can be filtered using TEST_TAG (e.g., export TEST_TAG=HiveSDRosa) and executed .
Co-authored: Claude

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot requested review from 2uasimojo and suhanime May 28, 2026 13:40
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

This PR adds two test-focused enhancements: environment-variable-driven test tag filtering in the extension test runner, and operator Deployment existence checking before OLM subscription creation. No exported APIs change.

Changes

Test Selection and Operator Initialization Enhancements

Layer / File(s) Summary
Environment-driven test selection
test/ote/cmd/extension/main.go
tagTests() helper reads TEST_TAG environment variable and returns a Ginkgo selector filtering specs by name substring, or nil if unset. This selector is conditionally added to the test selection functions list.
Deployment existence check in subscription creation
test/ote/hive/hive_util.go
subscription.createIfNotExist() now detects existing hive-operator Deployment and skips OLM subscription creation, waiting for the operator pod to reach Running state instead of proceeding with Subscription creation.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A rabbit hops through test selection gates,
Where tags filter specs at perfect rates.
Deployments checked before subscriptions bloom,
Smart operator logic clears the room. 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: introducing TEST_TAG environment variable for test grouping and filtering.
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.

✏️ 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

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/ote/cmd/extension/main.go (1)

190-198: ⚡ Quick win

Consider adding a doc comment.

The function follows the same pattern as shardTests() and limitTests(), but a brief doc comment would help document the expected format and behavior of TEST_TAG (e.g., substring match, case-sensitive).

📝 Suggested documentation
+// tagTests returns a SelectFunction that filters tests by name substring when TEST_TAG is set.
+// The filter performs a case-sensitive substring match against spec.Name.
+// Returns nil if TEST_TAG is unset, disabling tag-based filtering.
 func tagTests() et.SelectFunction {
 	tag := os.Getenv("TEST_TAG")
 	if tag == "" {
🤖 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/ote/cmd/extension/main.go` around lines 190 - 198, Add a brief doc
comment above the tagTests() function (matching the style used for shardTests()
and limitTests()) that documents the TEST_TAG environment variable: it enables
filtered test selection by returning an et.SelectFunction that performs a
substring match against spec.Name, is case-sensitive, and returns nil when
TEST_TAG is empty; include the expected format and an example of usage to make
behavior clear to readers and maintainers.
🤖 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/ote/hive/hive_util.go`:
- Around line 657-658: The code ignores the error returned by
oc.AsAdmin().WithoutNamespace().Run("get") and relies on fragile string matching
of deployOutput to detect "not found"; change the logic to capture and check the
returned error and use the more robust --ignore-not-found flag on the get call.
Specifically, update the
oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "hive-operator",
"-n", sub.namespace) invocation used to produce deployOutput so you assign both
(deployOutput, err) and if err != nil handle/report it (only treat absence as
non-error when output is empty due to --ignore-not-found), otherwise proceed
based on whether deployOutput is empty; reference the deployOutput variable and
the oc.AsAdmin()...Run("get") call to locate the change.

---

Nitpick comments:
In `@test/ote/cmd/extension/main.go`:
- Around line 190-198: Add a brief doc comment above the tagTests() function
(matching the style used for shardTests() and limitTests()) that documents the
TEST_TAG environment variable: it enables filtered test selection by returning
an et.SelectFunction that performs a substring match against spec.Name, is
case-sensitive, and returns nil when TEST_TAG is empty; include the expected
format and an example of usage to make behavior clear to readers and
maintainers.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 66114efd-500a-4eb9-b39e-0840938722fe

📥 Commits

Reviewing files that changed from the base of the PR and between a455a02 and 086bcf9.

📒 Files selected for processing (2)
  • test/ote/cmd/extension/main.go
  • test/ote/hive/hive_util.go

Comment thread test/ote/hive/hive_util.go
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.39%. Comparing base (ab4b249) to head (086bcf9).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2914   +/-   ##
=======================================
  Coverage   50.39%   50.39%           
=======================================
  Files         281      281           
  Lines       34368    34368           
=======================================
  Hits        17320    17320           
  Misses      15696    15696           
  Partials     1352     1352           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@2uasimojo 2uasimojo left a comment

Choose a reason for hiding this comment

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

/lgtm

/hold in case you want to address the rabbit's suggestion

Unhold if not :)

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 28, 2026
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 28, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 28, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 2uasimojo, miyadav

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 May 28, 2026
@2uasimojo
Copy link
Copy Markdown
Member

/override ci/prow/security

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 28, 2026

@2uasimojo: Overrode contexts on behalf of 2uasimojo: ci/prow/security

Details

In response to this:

/override ci/prow/security

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.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 28, 2026

@miyadav: all tests passed!

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.

@miyadav
Copy link
Copy Markdown
Member Author

miyadav commented May 29, 2026

/unhold

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 29, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit 91d3589 into openshift:master May 29, 2026
29 checks passed
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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants