Page MenuHomeSoftware Heritage

pathslicing: fix PathSlicingObjStorage.check() method
ClosedPublic

Authored by douardda on Jun 14 2019, 3:39 PM.

Details

Summary

it did not work for hex encoded obj_id.

Also:

  • tests/pathslicing: improve tests for the check() method validate we do have the expected error, namely 'not a gzip' and 'wrong hash id'.
  • pathslicing: fix the 'not a gzip' error message in check() write the hex obj id in the error message instead of the repr of the bytes.
  • tests/pathslicing: add a test for check() that ensure it does work we only had tests for non-valid checks.
  • Fixes test_objstorage_pathslicing.py's test_check_not_gzip.
  • Fixes test_objstorage_pathslicing.py's test_check_ok.

Diff Detail

Repository
rDOBJS Object storage
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz added inline comments.
swh/objstorage/backends/pathslicing.py
274 ↗(On Diff #5249)

How come both actual_obj_id.hex() and hashutil.hash_to_hex(actual_obj_id) work?

279 ↗(On Diff #5249)

Might as well use hex_obj_id

swh/objstorage/backends/pathslicing.py
274 ↗(On Diff #5249)

not sure, but let's keep using has_to_hex here, shall we?

279 ↗(On Diff #5249)

indeed

swh/objstorage/backends/pathslicing.py
274 ↗(On Diff #5249)

TIL byte objects have a .hex() method.

This revision is now accepted and ready to land.Jun 14 2019, 4:12 PM

apply vlorentz' suggestions

This revision was landed with ongoing or failed builds.Jun 14 2019, 5:32 PM
This revision was automatically updated to reflect the committed changes.