HIVE-3148: Adding TEST_TAG so we can group/filter tests #2914
Conversation
…rom privaterepo in ci to keep the kustomise operator build and not override it
|
@miyadav: This pull request references HIVE-3148 which is a valid jira issue. DetailsIn 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 openshift-eng/jira-lifecycle-plugin repository. |
📝 WalkthroughWalkthroughThis 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. ChangesTest Selection and Operator Initialization Enhancements
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/ote/cmd/extension/main.go (1)
190-198: ⚡ Quick winConsider adding a doc comment.
The function follows the same pattern as
shardTests()andlimitTests(), but a brief doc comment would help document the expected format and behavior ofTEST_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
📒 Files selected for processing (2)
test/ote/cmd/extension/main.gotest/ote/hive/hive_util.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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:
|
2uasimojo
left a comment
There was a problem hiding this comment.
/lgtm
/hold in case you want to address the rabbit's suggestion
Unhold if not :)
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/override ci/prow/security |
|
@2uasimojo: Overrode contexts on behalf of 2uasimojo: ci/prow/security DetailsIn 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. |
|
@miyadav: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
/unhold |
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
Chores