HomeSoftware Heritage

package loaders: Make test failures more helpful

Description

package loaders: Make test failures more helpful

Some tests did the following:

  1. build a snapshot
  2. get the snapshot from the storage
  3. compare it with the expected snapshot
  4. get the origin visit from the storage and check it

If the loader built a wrong snapshot, the test fails at step 2,
and the only information displayed is that the expected snapshot id
does not exist, which is very unhelpful.

Instead, I reordered them as: 1, 4, 2, 3. This way, if a wrong
snapshot is build by the loader, it is detected when comparing
the visit, and pytest shows the two hashes.
Then, the test can be modified to use the hash that is actually
generated to show the actual snapshot.

This is consistent with what was already done in the pypi loader.

Additionally, I made the following changes:

  1. always check stats last (because a difference in numbers is hardly actionable without testing other objects)
  2. add a few more snapshot id checks in visits
  3. deduplicated a hardcoded snapshot id.

Details

Provenance
vlorentzAuthored on Nov 4 2021, 3:49 PM
vlorentzPushed on Nov 10 2021, 2:20 PM
Parents
rDLDBASE89a0bfee48ca: deposit: Remove 'parent' deposit
Branches
Unknown
Tags
Unknown
Build Status
Buildable 24990
Build 39052: test-and-buildJenkins console · Jenkins