Skip to content

Add mount invariant test for FleetJobPaths COS-to-container paths#2210

Open
avilches wants to merge 5 commits into
mainfrom
fleets-path-invariant-test
Open

Add mount invariant test for FleetJobPaths COS-to-container paths#2210
avilches wants to merge 5 commits into
mainfrom
fleets-path-invariant-test

Conversation

@avilches

@avilches avilches commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds test_cos_to_container_mount_invariant to test_fleet_utils.py to verify that every (cos_key, cos_prefix) pair in FleetJobPaths resolves to the expected container path after PDS mounting.

The invariant: if a COS key is {prefix}/{filename} and prefix is mounted at mount_point, the container path must be mount_point/{filename}. Currently nothing catches a change to one side (e.g. renaming a COS prefix) without updating the other (the container path), so this test closes that gap.

The test covers all 9 relevant pairs across both custom jobs (4 cases) and provider jobs (5 cases, including the private log) in a single table-driven assertion:

for label, cos_key, prefix, mount, container in cases:
    relative = cos_key.removeprefix(prefix + "/")
    assert container == f"{mount}/{relative}", f"mount invariant failed for '{label}'"

@avilches avilches requested a review from a team as a code owner June 9, 2026 15:52
Comment thread gateway/tests/core/services/ibm_cloud/code_engine/fleets/test_fleet_utils.py Outdated
@avilches avilches self-assigned this Jun 9, 2026
marceloamaral
marceloamaral previously approved these changes Jun 9, 2026

@marceloamaral marceloamaral 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

Base automatically changed from provider-image-fleets to main June 9, 2026 16:21
@ElePT ElePT dismissed marceloamaral’s stale review June 9, 2026 16:21

The base branch was changed.

@avilches

avilches commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Tests were green, which shows that the code was correct. Now I'm changing the PR to add the refactor while keeping the test unchanged. I'm resolving conflicts and squash commit because the branch base change.

@avilches

avilches commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Refactor looks horrible, so close it. So, I would just keep this test only.

@ElePT ElePT added the project: fleets Label to identify fleets features label Jun 10, 2026
@avilches avilches enabled auto-merge June 10, 2026 14:27
@avilches

Copy link
Copy Markdown
Contributor Author

@ElePT @marceloamaral quick approve to merge plis?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

project: fleets Label to identify fleets features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants