Page MenuHomeSoftware Heritage

Draw contents from a byte string instead of generating arbitrary hashes
ClosedPublic

Authored by olasd on Mar 2 2020, 2:07 PM.

Details

Summary

This generates more realistic contents and avoids spurious HashCollisions when
generating a set of objects using these hypothesis strategies, at the cost of
slightly worse "boundary checking" (i.e. we won't check contents with a length >
4096 bytes).

Depends on D2738.

Test Plan

tox tests still pass

Diff Detail

Repository
rDMOD Data model
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 10829
Build 16264: tox-on-jenkinsJenkins
Build 16263: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Mar 2 2020, 2:12 PM
swh/model/hypothesis_strategies.py
153

Maybe use the swh.model.hashutil.DEFAULT_ALGORITHMS variable?

swh/model/hypothesis_strategies.py
153

The list of attributes is somewhat hardcoded in swh.model.model, so I elected not to do that.