Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ pubtools>=0.3.0
pubtools-pulplib>=2.45.0
more_executors>=2.7.0
pushcollector>=1.2.0
pushsource>=2.53.0
pushsource>=2.54.0
monotonic; python_version < '3.3'
anyio[trio]
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,9 @@ pushcollector==1.3.0 \
# via
# -r requirements.in
# pushsource
pushsource==2.53.0 \
--hash=sha256:0a5a7dd69d76097336b887acdeaf7967b8d45533f3d3a40920946a44ac351982 \
--hash=sha256:8b374a5775c60f0f8686f9b2605bcf7a9de650a8851aba9564b44e321452d829
pushsource==2.54.0 \
--hash=sha256:fac8ca4d5e2dc013da99aa7bebb7c7d90a7fac7a18ae05f6d903d6a0ba8cc798 \
--hash=sha256:fcc6d7b39f8db28249d222b38813b76a37e936a4590a9a28ca0ffcd30b0ac583
# via -r requirements.in
pyasn1==0.6.4 \
--hash=sha256:9c447d8431c947fe4c8febc4ed9e760bc29011a5b01e5c74b67025bd9fb8ce81 \
Expand Down
12 changes: 11 additions & 1 deletion src/pubtools/_pulp/tasks/push/phase/load_sums.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@ def run(self):
item.pushsource_item.name,
)

if not item.blocking_checksums:
if not item.pushsource_item.opener:
# No local file opener (e.g. a KonfluxSource item
# with a Pulp href as src). Pass through with
# whatever checksums are already set.
LOG.debug(
"Skipping checksum computation for non-local src: %s",
item.pushsource_item.src,
)
self.put_output(item)

elif not item.blocking_checksums:
# with_checksums (probably) won't block so just do
# it immediately, thus letting the next phase get hold
# of the item more quickly.
Expand Down
6 changes: 3 additions & 3 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -965,9 +965,9 @@ pushcollector==1.3.0 \
# via
# -r requirements.in
# pushsource
pushsource==2.53.0 \
--hash=sha256:0a5a7dd69d76097336b887acdeaf7967b8d45533f3d3a40920946a44ac351982 \
--hash=sha256:8b374a5775c60f0f8686f9b2605bcf7a9de650a8851aba9564b44e321452d829
pushsource==2.54.0 \
--hash=sha256:fac8ca4d5e2dc013da99aa7bebb7c7d90a7fac7a18ae05f6d903d6a0ba8cc798 \
--hash=sha256:fcc6d7b39f8db28249d222b38813b76a37e936a4590a9a28ca0ffcd30b0ac583
# via -r requirements.in
pyasn1==0.6.4 \
--hash=sha256:9c447d8431c947fe4c8febc4ed9e760bc29011a5b01e5c74b67025bd9fb8ce81 \
Expand Down
56 changes: 56 additions & 0 deletions tests/push/test_load_sums.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import time

import attr
Expand Down Expand Up @@ -118,6 +119,61 @@ def test_load_blocking_vs_nonblocking(tmpdir):
]


def test_load_no_opener_passthrough(caplog):
"""Verify that items without an opener (e.g. KonfluxSource items with a
Pulp href as src) are passed through without attempting checksum computation.
"""
caplog.set_level(logging.DEBUG)
ctx = Context()
in_queue = ctx.new_queue()
in_queue_writer = buffer.OutputBuffer(in_queue, ctx)

# Simulate KonfluxSource items: src is a Pulp href, opener is None,
# sha256sum is set but md5sum may be missing (FIPS mode).
for i in range(0, 4):
item = FilePushItem(
name="rpm%s.rpm" % i,
src="/api/pulp/content/rpm/packages/%s/" % i,
sha256sum=FAKE_SHA256,
opener=None,
)
in_queue_writer.write(PulpFilePushItem(pushsource_item=item))

in_queue_writer.flush()
in_queue.put(constants.FINISHED)

phase = LoadChecksums(
context=ctx,
in_queue=in_queue,
update_push_items=lambda *_: (),
)

with phase:
pass

assert not ctx.has_error

all_outputs = []
while True:
items = phase.out_queue.get()
if items is constants.FINISHED:
break
all_outputs.extend(items)

assert len(all_outputs) == 4

# Items should be passed through with their original checksums intact
for item in all_outputs:
assert item.pushsource_item.sha256sum == FAKE_SHA256
# md5sum was not set and should remain unset (not computed)
assert item.pushsource_item.md5sum is None

assert (
"Skipping checksum computation for non-local src: /api/pulp/content/rpm/packages/0/"
in caplog.text
)


def test_load_async_error(tmpdir, caplog):
"""Verify that the phase correctly handles errors which occur during
async calls to with_checksums().
Expand Down
Loading