Skip to content

test(harbor): install the fake registry for every Harbor test from conftest - #5321

Merged
kajalj22 merged 5 commits into
mainfrom
fix-harbor-manifest-offline-registry
Oct 30, 2026
Merged

kajalj22 merged 5 commits into
mainfrom
fix-harbor-manifest-offline-registry

Conversation

@kajalj22

@kajalj22 kajalj22 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • no_real_registry (autouse) and fake_registry move from test_harbor_tasks.py to tests/unit_tests/conftest.py, and FakeRegistryClient to a new tests/unit_tests/harbor_registry_fakes.py. The autouse fixture applies to every test_harbor* module, so a new Harbor test module cannot forget it. It requests monkeypatch only for those modules, so the fixture teardown order of other tests (the telemetry state reset) is unchanged. The per-module fixture imports are removed.
  • test_harbor_image_configs.py runs the real RegistryClient against its own fake HTTP registry, so it overrides no_real_registry with a no-op.

Why

Harbor tests that run prepare_target reached Docker Hub through the real registry client and failed with HTTP 429 for library/ubuntu:24.04 whenever a module forgot to import the autouse no_real_registry; test_harbor_manifest.py was one. #5213 fixed those modules by adding the import. This PR removes the need for it: the fixture lives in conftest and covers every Harbor module, so the same slip cannot happen again. RegistryClient._open does not retry HTTP errors, so any rate limit fails a test that reaches the registry.

No production code changes. No issue filed: this is a test-isolation follow-up to a CI failure on main.

Validation

  • A throwaway pytest plugin that fails any urllib request to a non-loopback host showed the Harbor tests reaching registry-1.docker.io without the fixture.
  • ruff check and ruff format --check pass on every changed file.
  • CI unit tests pass

Rollout evidence: N/A, test-only change.

🤖 Generated with Claude Code

test_harbor_manifest.py reached the real registry client in 10 tests: it
imported fake_registry but not the autouse no_real_registry fixture, so
every prepare outside the two classes that opt in resolved ubuntu:24.04
from Docker Hub and failed once the anonymous rate limit (HTTP 429) hit.

Import no_real_registry as the sibling Harbor test modules do. In
test_harbor_image_build.py, record an arm64 ubuntu base before the run
that asks for linux/arm64, instead of letting prepare resolve it again.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Kajal Jain <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@kajalj22

Copy link
Copy Markdown
Contributor Author

/ok to test 03aaf8c

@kajalj22

Copy link
Copy Markdown
Contributor Author

/review

…nftest

Opting in per module is how test_harbor_manifest.py reached Docker Hub: it
imported fake_registry but not no_real_registry. Move FakeRegistryClient to
harbor_registry_fakes.py and both fixtures to conftest.py, where
no_real_registry is autouse for every test_harbor* module, so a new module
cannot forget it. Drop the per-module fixture imports.

test_harbor_image_configs.py runs the real RegistryClient against its own
fake HTTP registry, so it overrides no_real_registry with a no-op.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Kajal Jain <[email protected]>
@kajalj22 kajalj22 changed the title test(harbor): keep manifest and image-build prepare tests off Docker Hub test(harbor): install the fake registry for every Harbor test from conftest Oct 29, 2026
@kajalj22

Copy link
Copy Markdown
Contributor Author

/ok to test 5756b28

@kajalj22

Copy link
Copy Markdown
Contributor Author

/review

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SHIP

LGTM — no concerns found. Reviewed all 14 changed files and affected registry-recording paths, including fixture isolation, the real-client fake-HTTP opt-out, and preservation of the platform-specific build test.

Static inspection only; tests were not executed.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:build Packaging, dependencies, containers, and releases ci CI, automation, test queue, or workflow infrastructure work labels Oct 29, 2026
@kajalj22
kajalj22 marked this pull request as ready for review October 29, 2026 17:12
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the ready-to-merge PR is approved, current, and waiting for final CI or merge label Oct 29, 2026

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SHIP

LGTM — no concerns found within the follow-up scope. Review 5701877365 approved this exact head without findings, and the trusted baseline is the same immutable tree. There are no subsequent changes or unresolved findings to assess; this is not a fresh whole-PR review.

One delegated report was unavailable; its fixture and fake-client scope was independently inspected. Static inspection only; tests were not executed.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.

adil-a
adil-a previously approved these changes Oct 29, 2026

@adil-a adil-a left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@kajalj22
kajalj22 enabled auto-merge October 29, 2026 17:29
…registry

Requesting monkeypatch in the root autouse fixture set it up first for every
unit test, so it was torn down after the other autouse fixtures. The
telemetry reset_telemetry_state teardown then ran while a test's patches
(sys.modules['nemo.lens'] removed) were still in place, leaving two nemo.lens
module objects and failing 8 tests in telemetry/test_setup.py. Fetch it with
request.getfixturevalue inside the Harbor branch so other tests keep their
fixture order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Kajal Jain <[email protected]>
@kajalj22
kajalj22 dismissed stale reviews from adil-a and svcnvidia-nemo-ci via 41d8797 October 29, 2026 19:13
@kajalj22

Copy link
Copy Markdown
Contributor Author

/ok to test 41d8797

@kajalj22

Copy link
Copy Markdown
Contributor Author

/review reset=true

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SHIP

LGTM — no concerns found within the follow-up scope.

Compared against the clean reviewed baseline at 5756b28. Checked the conditional monkeypatch setup, including telemetry teardown isolation, Harbor fake-state consumers, and the real-client opt-out. Also traced the mirrored Docker image change through environment creation and Docker launch, checking preservation of both detached-process cancellation cases.

No prior findings remained unresolved, and no introduced regressions were established. This was not a fresh whole-PR review. Static inspection only; tests and image pulls were not executed.

Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.

adil-a
adil-a previously approved these changes Oct 29, 2026
@kajalj22
kajalj22 added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 29, 2026
main (#5213) fixed the same two Docker Hub failures separately: it pulls the
deadline test image from ECR Public pinned by digest, and gives the arm64
image-build test a multi-arch registry stand-in. Both of main's versions are
kept, replacing this branch's mirror.gcr.io image and arm64 record edit.
The fixtures still move into conftest, so the per-module no_real_registry
imports main added are dropped; main's moved config and path_utils imports
are kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Kajal Jain <[email protected]>
@kajalj22
kajalj22 dismissed stale reviews from adil-a and svcnvidia-nemo-ci via d9f2bde October 30, 2026 15:54
@kajalj22 kajalj22 changed the title test(harbor): keep Harbor tests from pulling from Docker Hub test(harbor): install the fake registry for every Harbor test from conftest Oct 30, 2026
@kajalj22

Copy link
Copy Markdown
Contributor Author

/ok to test d9f2bde

@kajalj22

Copy link
Copy Markdown
Contributor Author

/review reset=true

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SHIP

LGTM — no concerns found.

Completed a fresh review of all 13 changed files and affected paths. Checked fixture isolation and conditional monkeypatch setup, migrated fake-state consumers, and the real-client HTTP opt-out. Also traced preservation of non-Harbor telemetry teardown, imported fixtures, and platform-specific image-record reuse.

Static inspection only; tests were not executed.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@kajalj22

Copy link
Copy Markdown
Contributor Author

/review-approve

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SHIP

LGTM — no concerns found within the follow-up scope.

The latest bot review, 5715055268, reported no findings at this exact head. The trusted baseline is the same immutable tree, so there are no subsequent changes or unresolved findings to assess. This is not a fresh whole-PR review.

Static inspection only; tests were not executed.

Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.

@kajalj22
kajalj22 added this pull request to the merge queue Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41100653280

Merged via the queue into main with commit 3dfe424 Oct 30, 2026
56 of 59 checks passed
@kajalj22
kajalj22 deleted the fix-harbor-manifest-offline-registry branch October 30, 2026 18:26

This branch was previously deployed

1 inactive deployment
public — d9f2bdef Deployed Oct 30, 2026 by copy-pr-bot[bot] via release / finalize / notify #8693
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:build Packaging, dependencies, containers, and releases ci CI, automation, test queue, or workflow infrastructure work ready-to-merge PR is approved, current, and waiting for final CI or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants