Skip to content

Commit

Permalink
Use the token while inspecting the index image
Browse files Browse the repository at this point in the history
  • Loading branch information
yashvardhannanavati committed Sep 21, 2020
1 parent f587675 commit d9f5c59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion iib/workers/tasks/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,10 @@ def handle_add_request(
msg = 'Checking if bundles are already present in index image'
log.info(msg)
set_request_state(request_id, 'in_progress', msg)
present_bundles = _get_present_bundles(from_index, temp_dir)

with set_registry_token(overwrite_from_index_token, from_index):
present_bundles = _get_present_bundles(from_index, temp_dir)

filtered_bundles = _get_missing_bundles(present_bundles, resolved_bundles)
excluded_bundles = [
bundle for bundle in resolved_bundles if bundle not in filtered_bundles
Expand Down
5 changes: 5 additions & 0 deletions tests/test_workers/test_tasks/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,9 @@ def test_skopeo_copy_fail_max_retries(mock_run_cmd):
@mock.patch('iib.workers.tasks.build._add_ocp_label_to_index')
@mock.patch('iib.workers.tasks.build._get_present_bundles')
@mock.patch('iib.workers.tasks.build._get_missing_bundles')
@mock.patch('iib.workers.tasks.build.set_registry_token')
def test_handle_add_request(
mock_srt,
mock_gmb,
mock_gpb,
mock_aolti,
Expand Down Expand Up @@ -737,6 +739,7 @@ def test_handle_add_request(
filter_args = mock_gmb.call_args[0]
assert ['some-bundle@sha'] in filter_args
mock_oia.assert_called_once()
mock_srt.assert_called_once()

assert mock_bi.call_count == len(arches)
assert mock_pi.call_count == len(arches)
Expand Down Expand Up @@ -833,7 +836,9 @@ def test_handle_add_request_bundle_resolution_failure(mock_grb, mock_srs, mock_c
@mock.patch('iib.workers.tasks.build._add_ocp_label_to_index')
@mock.patch('iib.workers.tasks.build._get_present_bundles')
@mock.patch('iib.workers.tasks.build._get_missing_bundles')
@mock.patch('iib.workers.tasks.build.set_registry_token')
def test_handle_add_request_backport_failure_no_overwrite(
mock_srt,
mock_gmb,
mock_gpb,
mock_aolti,
Expand Down

0 comments on commit d9f5c59

Please sign in to comment.