Page MenuHomeSoftware Heritage

Add tests checking round-tripping of dir/rev/rel/snp objects generated by Hypothesis
ClosedPublic

Authored by vlorentz on Dec 9 2021, 5:28 PM.

Details

Summary

Depends on D6815 and D6819 D6825 (which both address bugs found while writing this diff)

Diff Detail

Repository
rDSTO Storage manager
Branch
weird-git
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 25618
Build 40059: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 40058: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D6821 (id=24706)

Could not rebase; Attempt merge onto 7cb4128e40...

Updating 7cb4128e..dabaa329
Fast-forward
 swh/storage/postgresql/converters.py            |   5 +-
 swh/storage/tests/storage_data.py               |  23 +++
 swh/storage/tests/storage_tests.py              | 128 +++++++++++++++-
 swh/storage/tests/test_postgresql.py            |   7 +
 swh/storage/tests/test_postgresql_converters.py | 187 +++++++++++++++++-------
 5 files changed, 292 insertions(+), 58 deletions(-)
Changes applied before test
commit dabaa3292e61f41344d276ae0756d94ca325bfa3
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Dec 9 17:27:14 2021 +0100

    Add tests checking round-tripping of dir/rev/rel/snp objects generated by Hypothesis

commit 7765309a7e3b8a2d2e8f59fd434849fe247e28a3
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Dec 9 17:04:40 2021 +0100

    Add test_revision_add_old, xfail on postgresql

commit 110e2c3cbd6fca00a0e8cce5e43cf81c7fd216cc
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Dec 9 16:25:20 2021 +0100

    postgresql: Fix one-by-one error in db_to_date on negative dates
    
    Using `int()` on `date.timestamp()` rounded it up (toward zero),
    but the semantics of `model.Timestamp` is that the actual time is
    `ts.seconds + ts.microseconds/1000000`, so all negative dates were
    shifted one second up.
    
    In particular, this causes dates from
    `1969-12-31T23:59:59.000001` to `1969-12-31T23:59:59.999999`
    (inclusive) to smash into dates from
    `1970-01-01T00:00:00.000001` to `1970-01-01T00:00:00.999999`,
    which is how I discovered the issue.

commit 34ca67e21f68de920f603223f629070683018c2a
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Dec 9 16:23:44 2021 +0100

    postgresql: Add tests for db_to_date.

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1503/ for more details.

olasd added a subscriber: olasd.
olasd added inline comments.
swh/storage/tests/storage_tests.py
1077–1081

Is this still needed?

1530–1534

same question :-)

This revision is now accepted and ready to land.Dec 14 2021, 12:05 PM
vlorentz added inline comments.
swh/storage/tests/storage_tests.py
1077–1081

indeed not, thx

Build is green

Patch application report for D6821 (id=24765)

Could not rebase; Attempt merge onto fb1b3a066f...

Updating fb1b3a06..118f6eba
Fast-forward
 swh/storage/postgresql/storage.py  |  10 ++-
 swh/storage/tests/storage_tests.py | 132 +++++++++++++++++++++++++++++++++++--
 2 files changed, 135 insertions(+), 7 deletions(-)
Changes applied before test
commit 118f6ebabf88197e19a41112c3a9e87dbf386e23
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Dec 9 17:27:14 2021 +0100

    Add tests checking round-tripping of dir/rev/rel/snp objects generated by Hypothesis

commit 08e1adee3f65bd3a519a745be3848a44c6dd147c
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Dec 9 17:04:40 2021 +0100

    Add test_revision_add_fractional_timezone

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1507/ for more details.

vlorentz marked an inline comment as done.

rebase

Build is green

Patch application report for D6821 (id=24797)

Could not rebase; Attempt merge onto fb1b3a066f...

Updating fb1b3a06..c40ceb32
Fast-forward
 swh/storage/postgresql/storage.py  |  13 +++-
 swh/storage/tests/storage_tests.py | 132 +++++++++++++++++++++++++++++++++++--
 2 files changed, 138 insertions(+), 7 deletions(-)
Changes applied before test
commit c40ceb329f445bbf0b536c24f1a357aba4c2e7b0
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Dec 9 17:27:14 2021 +0100

    Add tests checking round-tripping of dir/rev/rel/snp objects generated by Hypothesis

commit 45687d8c68298abb69172386eca04e318eefc29c
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Dec 9 17:04:40 2021 +0100

    Add test_revision_add_fractional_timezone

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1510/ for more details.