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
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 6223
Build 8597: tox-on-jenkinsJenkins
Build 8596: arc lint + arc unit

Event Timeline

vlorentz added inline comments.
swh/objstorage/backends/pathslicing.py
274

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

278

Might as well use hex_obj_id

swh/objstorage/backends/pathslicing.py
274

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

278

indeed

swh/objstorage/backends/pathslicing.py
274

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.