Skip to content

Commit 3663915

Browse files
author
fullsend-code
committed
test(#1339): add test for FBC with empty index_repo_map
Add a fourth parametrize entry to test_overwrite_from_index covering the case where is_image_fbc=True but url_repo_map is empty ({}). This tests the guard added in PR #1338 (commit cad01fa) that skips get_catalog_dir and push_configs_to_git when the index_repo_map is empty (containerized IIB path where push was already done earlier). Changes: - Add parametrize case: FBC=True, empty url_repo_map, different registries (no OCI export) - Update assertion condition from `if is_image_fbc` to `if is_image_fbc and url_repo_map` to match production guard - Add mock_pcg.assert_not_called() in the else branch to verify push_configs_to_git is also skipped when appropriate Note: Full pytest suite could not run due to missing krb5-dev system library (required by gssapi/requests-kerberos). Test logic was validated via isolated mock-based execution of all 4 cases. Closes #1339
1 parent cad01fa commit 3663915

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

tests/test_workers/test_tasks/test_build.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,15 @@ def test_get_local_pull_spec(request_id, arch):
401401
True,
402402
{"quay.io/ns/repo:1": "https://fake.url.git"},
403403
),
404+
(
405+
'quay.io/ns/repo:1',
406+
'docker.io/user_ns/repo:v1',
407+
'quay.io/user_ns/repo:abcdef',
408+
'user:pass',
409+
False,
410+
True,
411+
{},
412+
),
404413
),
405414
)
406415
@mock.patch('iib.workers.tasks.build.set_request_state')
@@ -459,7 +468,7 @@ def test_overwrite_from_index(
459468
)
460469

461470
# Verify catalog config handling
462-
if is_image_fbc:
471+
if is_image_fbc and url_repo_map:
463472
mock_gcd.assert_called_once_with(
464473
from_index=output_pull_spec,
465474
base_dir=mock_temp_dir_2,
@@ -480,6 +489,7 @@ def test_overwrite_from_index(
480489
)
481490
else:
482491
mock_gcd.assert_not_called()
492+
mock_pcg.assert_not_called()
483493

484494
if oci_export_expected:
485495
oci_pull_spec = f'oci:{mock_temp_dir_1.name}'

0 commit comments

Comments
 (0)