CLID-614: Test for Operator incremental mirroring#1413
Conversation
|
@nidangavali: This pull request references CLID-614 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set. 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: nidangavali The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
WalkthroughAdds test helpers for logging oc-mirror results and inspecting tar archives, plus a Ginkgo integration spec that mirrors an initial operator ISC, preserves its tar, runs an updated ISC into the same workdir, and asserts the incremental tar contains only new blobs and expected contents. ChangesIntegration test for incremental operator mirroring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 10 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (10 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@tests/integration/incremental_test.go`:
- Around line 36-38: The test currently hardcodes "mirror_000001.tar" (assigned
to initialTar) which can break if sequence naming changes; replace the hardcoded
lookup by discovering produced mirror tar files in workDir with a glob like
"mirror_*.tar", assert the glob returns at least one match, sort the matches (by
filename or modtime) to pick the intended archive (first/earliest for initial,
next for subsequent), assign that path to initialTar (and the later tar variable
used around logTarSummary), and then call logTarSummary with the discovered
path; update any other hardcoded uses of "mirror_00000X.tar" similarly.
- Around line 68-70: The current assertion using
Expect(incrementalBlobs).NotTo(ConsistOf(initialBlobs)) only proves the sets
differ; change the test to assert the incremental tar contains none of the
previously mirrored blobs by verifying there is no intersection between
incrementalBlobs and initialBlobs. Replace the ConsistOf-based assertion with
one that checks incrementalBlobs does not contain any element from initialBlobs
(e.g., assert the intersection length is zero or use a Gomega matcher that
ensures no elements from initialBlobs appear in incrementalBlobs) referencing
the incrementalBlobs and initialBlobs variables and the Expect call.
🪄 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: d60a918f-b59b-49dd-aa3e-496c58791e63
📒 Files selected for processing (4)
tests/integration/helpers_test.gotests/integration/incremental_test.gotests/integration/testdata/imagesetconfigs/operators/isc-operator-incremental-initial.yamltests/integration/testdata/imagesetconfigs/operators/isc-operator-incremental-update.yaml
|
/retest |
|
@nidangavali: 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. |
aguidirh
left a comment
There was a problem hiding this comment.
Thanks for the PR, I just added few comments to it.
Please add a PR description following the template on .github directory and if possible also a commit message with context about the changes for future reference.
| for _, b := range incrementalBlobs { | ||
| _, alreadyMirrored := initialBlobSet[b] | ||
| Expect(alreadyMirrored).To(BeFalse(), | ||
| "incremental tar re-included previously mirrored blob: %s", b) | ||
| } |
There was a problem hiding this comment.
It would be good if we could check if the blobs of the incremental run were included correctly. Currently we are only checking if the initial blobs were not included.
| By("moving the initial tar outside the working directory to preserve it") | ||
| preserveDir, err := os.MkdirTemp("", "oc-mirror-preserved-tar-*") | ||
| Expect(err).NotTo(HaveOccurred()) | ||
| defer os.RemoveAll(preserveDir) | ||
| preservedTar := filepath.Join(preserveDir, "mirror_initial.tar") | ||
| err = os.Rename(initialTar, preservedTar) | ||
| Expect(err).NotTo(HaveOccurred(), "failed to move initial tar") |
There was a problem hiding this comment.
It seems we're not using the initial tar later, so this is dead code that can be removed. Or am I missing anything?
| logTarSummary("initial", initialTar) | ||
|
|
||
| By("verifying the initial tar contains expected content") | ||
| expectCorrectTarArchiveContents(iscInitialPath, workDir) |
There was a problem hiding this comment.
Are we also checking the blobs here? Only only the directory path?
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Github / Jira issue:
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.
Expected Outcome
Please describe the outcome expected from the tests.
Summary by CodeRabbit