Page MenuHomeSoftware Heritage

Truncate RawExtrinsicMetadata.discovery_date to a second
ClosedPublic

Authored by olasd on Mar 17 2021, 6:54 PM.

Details

Summary

This truncation is already enshrined at the identifier level. Truncate
the object itself as well, to reduce the possibility multiple different
metadata objects with the same identifier.

Test Plan

new test added. Also checked that the swh.storage tests still pass,
which is the case as the test data was already an integer number of seconds.

Diff Detail

Repository
rDMOD Data model
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 19985
Build 31024: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 31023: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D5272 (id=18889)

Rebasing onto 975e9892b6...

Current branch diff-target is up to date.
Changes applied before test
commit e58ca1b05f8d564424c9e8bfd8a948a077446f4d
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 17 18:51:29 2021 +0100

    Truncate RawExtrinsicMetadata.discovery_date to a second
    
    This truncation is already enshrined at the identifier level. Truncate
    the object itself as well, to reduce the possibility multiple different
    metadata objects with the same identifier.

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

olasd requested review of this revision.Mar 17 2021, 6:55 PM
vlorentz added inline comments.
swh/model/model.py
889

not tested

swh/model/tests/test_model.py
1160

what does this test?

This revision is now accepted and ready to land.Mar 17 2021, 8:05 PM
swh/model/model.py
889

It wasn't tested before, but fair enough.

swh/model/tests/test_model.py
1160

That the timezone gets properly normalized to UTC.

Add test for RawExtrinsicMetadata TypeError

Build is green

Patch application report for D5272 (id=18899)

Rebasing onto 975e9892b6...

Current branch diff-target is up to date.
Changes applied before test
commit 82e626d1429e877735cd078d3cd82de07d302ffe
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 17 18:51:29 2021 +0100

    Truncate RawExtrinsicMetadata.discovery_date to a second
    
    This truncation is already enshrined at the identifier level. Truncate
    the object itself as well, to reduce the possibility multiple different
    metadata objects with the same identifier.

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

Add some comments in the new test

Build is green

Patch application report for D5272 (id=18900)

Rebasing onto 975e9892b6...

Current branch diff-target is up to date.
Changes applied before test
commit af5e4614c8eb64178793e92d08a30eca472ed5ee
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 17 18:51:29 2021 +0100

    Truncate RawExtrinsicMetadata.discovery_date to a second
    
    This truncation is already enshrined at the identifier level. Truncate
    the object itself as well, to reduce the possibility multiple different
    metadata objects with the same identifier.

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