pulp / pulp_deb

Debian repository plugin for Pulp (pulpproject.org)
GNU General Public License v2.0
61 stars 78 forks source link

Tests fail depending on which checksums are enabled #756

Open daviddavis opened 1 year ago

daviddavis commented 1 year ago

If you don't configure ALLOWED_CONTENT_CHECKSUMS, it defaults to everything but md5 and sha1. And it looks like tests will fail in this case:

E           pulpcore.exceptions.validation.UnsupportedDigestValidationError: Checksum algorithms ['md5', 'sha1'] are forbidden for this Pulp instance.

../pulpcore/pulpcore/app/models/content.py:269: UnsupportedDigestValidationError
============================================================== short test summary info ===============================================================
FAILED pulp_deb/tests/unit/test_models.py::TestPackage::test_filename - pulpcore.exceptions.validation.UnsupportedDigestValidationError: Checksum a...

I think ideally the test should either not rely on these checksums or be skipped if the checksums they require a certain checksum that is not enabled. Here's an example of the latter:

https://github.com/pulp/pulp_rpm/blob/77b19890daf5ceb7a11aa701033d81e97983468d/pulp_rpm/tests/functional/api/test_sync.py#L797-L800

quba42 commented 1 year ago

This is by design/deliberate (which does not mean it should not be changed). Our reasoning was that we have configured the CI and our dev boxes to allow these checksums to facilitate these tests, so there was never any pressure to change. If you know of a better way to facilitate testing on boxes that don't have the setting, I am open to changing things.

daviddavis commented 1 year ago

Did you catch my proposal to skip the test if the checksum is not enabled? Here's an example from pulp_rpm:

https://github.com/pulp/pulp_rpm/blob/77b19890daf5ceb7a11aa701033d81e97983468d/pulp_rpm/tests/functional/api/test_sync.py#L797-L800

quba42 commented 1 year ago

@daviddavis I read the proposal to skip but I did not look at the RPM example. (One can see a lot by looking)

I am all for copying pulp_rpm and keeping plugins similar. Will remove the Triage-Needed label.