Page MenuHomeSoftware Heritage

Add test_revision_add_fractional_timezone
ClosedPublic

Authored by vlorentz on Dec 13 2021, 1:23 PM.

Diff Detail

Repository
rDSTO Storage manager
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D6825 (id=24749)

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

Updating 7cb4128e..824d823e
Fast-forward
 requirements.txt                                |   2 +-
 swh/storage/postgresql/converters.py            |   7 +-
 swh/storage/tests/storage_tests.py              |  31 ++++
 swh/storage/tests/test_postgresql_converters.py | 187 +++++++++++++++++-------
 4 files changed, 174 insertions(+), 53 deletions(-)
Changes applied before test
commit 824d823e6f7d4b5aaca3c7ac78aa0dd63b3190f7
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Dec 9 17:04:40 2021 +0100

    Add test_revision_add_fractional_timezone

commit fb1b3a066ff0898318ea28c901761c5c3562f0f6
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/1505/ for more details.

Add workaround to support fractional timezones on psycopg2 < 2.9.0.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 14 2021, 11:22 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.

Build is green

Patch application report for D6825 (id=24761)

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

Updating 7cb4128e..08e1adee
Fast-forward
 swh/storage/postgresql/converters.py            |   7 +-
 swh/storage/postgresql/storage.py               |  10 +-
 swh/storage/tests/storage_tests.py              |  39 +++++
 swh/storage/tests/test_postgresql_converters.py | 187 +++++++++++++++++-------
 4 files changed, 190 insertions(+), 53 deletions(-)
Changes applied before test
commit 08e1adee3f65bd3a519a745be3848a44c6dd147c
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Dec 9 17:04:40 2021 +0100

    Add test_revision_add_fractional_timezone

commit fb1b3a066ff0898318ea28c901761c5c3562f0f6
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/1506/ for more details.

oops, I messed up git again, this isn't actually landed

remove commit that was already landed

Build is green

Patch application report for D6825 (id=24767)

Rebasing onto fb1b3a066f...

Current branch diff-target is up to date.
Changes applied before test
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/1508/ for more details.

olasd added inline comments.
swh/storage/postgresql/storage.py
120 ↗(On Diff #24767)

Should probably happen here too?

This revision is now accepted and ready to land.Dec 15 2021, 12:59 PM

Build is green

Patch application report for D6825 (id=24796)

Rebasing onto fb1b3a066f...

Current branch diff-target is up to date.
Changes applied before test
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/1509/ for more details.