Skip to content

CLID-625, CLID-626: Tests for --parallel-images and --parallel-layers flags#1415

Merged
openshift-merge-bot[bot] merged 3 commits into
openshift:mainfrom
adolfo-ab:parallel-test
May 29, 2026
Merged

CLID-625, CLID-626: Tests for --parallel-images and --parallel-layers flags#1415
openshift-merge-bot[bot] merged 3 commits into
openshift:mainfrom
adolfo-ab:parallel-test

Conversation

@adolfo-ab
Copy link
Copy Markdown
Contributor

@adolfo-ab adolfo-ab commented May 20, 2026

Description

Adds tests for --parallel-images and --parallel-layers flags.
Replaces manual tests OCP-83188 and OCP-83189.

Github / Jira issue:
CLID-625, CLID-626

  • Code Improvements (Refactoring, Performance, CI upgrades, etc)

How Has This Been Tested?

By running the tests

Summary by CodeRabbit

  • Tests
    • Added an integration test suite validating parallel image and layer copying behavior and concurrency limits, plus supporting test images and configurations for parallel-copy scenarios.
  • Documentation
    • Added READMEs describing the additional multi-layer test images, how to build/publish them, and the image reference used by tests.
  • Bug Fixes
    • Adjusted mirror retry behavior to better recover from a broader range of server error responses.

@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 20, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 20, 2026

@adolfo-ab: This pull request references CLID-625 which is a valid jira issue.

This pull request references CLID-626 which is a valid jira issue.

Details

In response to this:

Description

Adds tests for --parallel-images and --parallel-layers flags.
Replaces manual tests OCP-83188 and OCP-83189.

Github / Jira issue:
CLID-625, CLID-626

  • Code Improvements (Refactoring, Performance, CI upgrades, etc)

How Has This Been Tested?

By running the tests

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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Walkthrough

This PR adds integration tests for oc-mirror's parallel copy feature, a multilayer test image and build tooling, YAML test inputs for image- and layer-parallel scenarios, and a small change to retry logic treating HTTP 500–504 as retryable.

Changes

Parallel copy integration tests

Layer / File(s) Summary
Multilayers test image and build infrastructure
tests/integration/image-builders/additional_images/README.md, tests/integration/image-builders/additional_images/multilayers/Dockerfile, tests/integration/image-builders/additional_images/multilayers/Makefile, tests/integration/image-builders/additional_images/multilayers/README.md
A new multilayer OCI image definition with ten sequential RUN steps, a parameterized Makefile for build/push, and docs describing the image used for --parallel-layers testing.
ImageSetConfiguration test data
tests/integration/testdata/imagesetconfigs/parallel_copy/isc-multilayers.yaml, tests/integration/testdata/imagesetconfigs/parallel_copy/isc-parallel-images.yaml
Two YAML fixtures: one references the multilayers image for layer-parallel tests; the other supplies ten additional image tags to exercise image-parallel behavior.
Parallel copy test suite and validation helpers
tests/integration/parallel_copy_test.go
Ginkgo suite that runs mirror operations with configured --parallel-layers and --parallel-images, plus helpers (mirrorCopyOutput, imagesToCopyCount, and expectMinImagesToCopy) to parse oc-mirror output and assert expected queued-image counts.

Mirror retry policy

Layer / File(s) Summary
HTTP server-error retry range update
internal/pkg/mirror/mirror.go
isErrorRetryable now treats HTTP 500–504 responses as retryable (previously 502–504).

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Ipv6 And Disconnected Network Test Compatibility ⚠️ Warning Test requires pulling images from public quay.io registry, failing in disconnected environments (e.g., IPv6-only CI jobs with no internet access). Use a local mirror or internal registry instead of external quay.io, or add [Skipped:Disconnected] to skip on disconnected clusters.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main purpose of the pull request: adding tests for the --parallel-images and --parallel-layers flags, which directly corresponds to the primary changes (new test file and supporting integration test infrastructure).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 All Ginkgo test names in parallel_copy_test.go are stable, static string literals with no dynamic content (no UUIDs, timestamps, pod names, or generated suffixes).
Test Structure And Quality ✅ Passed Tests follow codebase quality patterns: proper BeforeEach/AfterEach, meaningful assertion messages, consistent with conventions. Context has 30-min suite timeout.
Microshift Test Compatibility ✅ Passed New tests only execute oc-mirror CLI with local registry; no Kubernetes cluster APIs or MicroShift-unavailable OpenShift APIs used. Tests are cluster-agnostic and fully MicroShift-compatible.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The new Ginkgo tests are CLI integration tests for oc-mirror, not OpenShift cluster E2E tests. They use no Kubernetes APIs and have no multi-node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed This PR adds integration tests and test data (Dockerfiles, YAML configs) but introduces no deployment manifests, operator code, or controllers that could have topology-aware scheduling constraints.
Ote Binary Stdout Contract ✅ Passed No OTE Binary Stdout Contract violations. New test file contains only test blocks with no process-level stdout writes. Modified mirror.go has no stdout writes.

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

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

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 aguidirh and r4f4 May 20, 2026 15:15
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

🤖 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/image-builders/additional_images/multilayers/Makefile`:
- Line 19: The Makefile's digest target uses an invalid Go-template expression;
replace the incorrect use of the index function with a direct field access. Edit
the command that runs $(RUNTIME) inspect $(IMAGE_REF) --format '{{index
.Digest}}' to use '{{.Digest}}' instead so the template accesses the Digest
field directly (references: RUNTIME, IMAGE_REF, the inspect --format invocation
in the digest target).
🪄 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: 271c83ca-8b7a-4983-9d5c-fcc0170306aa

📥 Commits

Reviewing files that changed from the base of the PR and between edb3e8c and 623b9a5.

📒 Files selected for processing (7)
  • tests/integration/image-builders/additional_images/README.md
  • tests/integration/image-builders/additional_images/multilayers/Dockerfile
  • tests/integration/image-builders/additional_images/multilayers/Makefile
  • tests/integration/image-builders/additional_images/multilayers/README.md
  • tests/integration/parallel_copy_test.go
  • tests/integration/testdata/imagesetconfigs/parallel_copy/isc-multilayers.yaml
  • tests/integration/testdata/imagesetconfigs/parallel_copy/isc-parallel-images.yaml

Copy link
Copy Markdown
Contributor

@aguidirh aguidirh left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I added few comments.

Needs to check why the integration test is failing, is it because of some kind of race condition when images share the same blob on few layers?

Comment thread tests/integration/parallel_copy_test.go Outdated
Comment thread tests/integration/parallel_copy_test.go Outdated
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.

🧹 Nitpick comments (1)
internal/pkg/mirror/mirror.go (1)

240-242: ⚡ Quick win

Consider excluding HTTP 501 from the retry range.

The current condition retries all HTTP status codes 500–504. However, HTTP 501 (Not Implemented) is not a transient error and should not be retried—if a server lacks the functionality, repeated attempts will continue to fail.

Consider explicitly excluding 501 to avoid unnecessary retry attempts.

♻️ Proposed fix to exclude HTTP 501
 	case errors.As(err, &httpError):
-		// Retry on 500-504 server errors, they appear to be quite common in the field
+		// Retry on transient 5xx server errors (500, 502-504), they appear to be quite common in the field
 		// We duplicate this here because older versions of oc-mirror cannot bump containers/common given Golang version restrictions
-		if httpError.StatusCode >= http.StatusInternalServerError && httpError.StatusCode <= http.StatusGatewayTimeout {
+		if (httpError.StatusCode >= http.StatusInternalServerError && httpError.StatusCode <= http.StatusGatewayTimeout) && httpError.StatusCode != http.StatusNotImplemented {
 			return true
 		}
🤖 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 `@internal/pkg/mirror/mirror.go` around lines 240 - 242, The retry condition
currently treats all status codes from 500 to 504 as transient; change the check
around httpError.StatusCode (in mirror.go) to exclude 501 (HTTP
StatusNotImplemented) so it is not retried—update the if that reads
"httpError.StatusCode >= http.StatusInternalServerError && httpError.StatusCode
<= http.StatusGatewayTimeout" to also ensure httpError.StatusCode !=
http.StatusNotImplemented (i.e., only retry 500, 502–504).
🤖 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.

Nitpick comments:
In `@internal/pkg/mirror/mirror.go`:
- Around line 240-242: The retry condition currently treats all status codes
from 500 to 504 as transient; change the check around httpError.StatusCode (in
mirror.go) to exclude 501 (HTTP StatusNotImplemented) so it is not
retried—update the if that reads "httpError.StatusCode >=
http.StatusInternalServerError && httpError.StatusCode <=
http.StatusGatewayTimeout" to also ensure httpError.StatusCode !=
http.StatusNotImplemented (i.e., only retry 500, 502–504).

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: a3210d62-fb44-4f23-8987-427502e9d4e3

📥 Commits

Reviewing files that changed from the base of the PR and between 623b9a5 and 82366d0.

📒 Files selected for processing (1)
  • internal/pkg/mirror/mirror.go

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

🤖 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/parallel_copy_test.go`:
- Around line 30-36: The It blocks call runner.MirrorToDisk with
"--parallel-layers"/"--parallel-images" but only assert success, so the test
doesn't verify the flags actually changed concurrency; update the tests in
parallel_copy_test.go to either (A) observe an external concurrency signal from
the operation (e.g., inject or mock a layer fetcher in runner.MirrorToDisk to
record concurrent goroutine counts and assert >1 when "--parallel-layers" is
set, or check timestamps of mocked layer downloads to ensure overlapping
execution) and add assertions on that signal, or (B) if such instrumentation is
not available, rename the It descriptions to "accepts
--parallel-layers/--parallel-images flag" and keep only success assertions;
refer to runner.MirrorToDisk and the existing It/By blocks to locate where to
add the concurrency probe or rename the test.
🪄 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: d3df9f5d-8204-47f9-a8b2-c7c0fc491413

📥 Commits

Reviewing files that changed from the base of the PR and between 82366d0 and 349ca3f.

📒 Files selected for processing (1)
  • tests/integration/parallel_copy_test.go

Comment thread tests/integration/parallel_copy_test.go
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 27, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adolfo-ab, aguidirh

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 27, 2026
Copy link
Copy Markdown
Contributor

@r4f4 r4f4 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 29, 2026
@aguidirh
Copy link
Copy Markdown
Contributor

/assign @nidangavali

For learning purposes only.

@aguidirh
Copy link
Copy Markdown
Contributor

/verified bypass

Since there is no production code being changed, there is no need to verify.

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label May 29, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@aguidirh: The verified label has been added.

Details

In response to this:

/verified bypass

Since there is no production code being changed, there is no need to verify.

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
Copy link
Copy Markdown

openshift-ci Bot commented May 29, 2026

@adolfo-ab: 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.

@openshift-merge-bot openshift-merge-bot Bot merged commit c87c154 into openshift:main May 29, 2026
12 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. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants