Page MenuHomeSoftware Heritage

test_storage: Add journal behavior coverage for origin-visit-*add
ClosedPublic

Authored by ardumont on Jun 15 2020, 11:28 AM.

Details

Summary

This was missing some coverage on origin-visit-add and origin-visit-status-add
for the journal part.

Note that this drops a redundant origin-visit-add test (which did the same as
the current origin-visit-add test but for only 1 visit).

Depends on D3277

Related to T2310

Test Plan

tox

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 D3279 (id=11626)

Could not rebase; Attempt merge onto 33efdb0dd4...

Updating 33efdb0..1ca3154
Fast-forward
 swh/storage/tests/test_storage.py | 165 +++++++++++++++-----------------------
 swh/storage/validate.py           |  32 +++++---
 2 files changed, 86 insertions(+), 111 deletions(-)
Changes applied before test
commit 1ca31548ac6ae662e95de819bcdbc3eeb0f5aa6b
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jun 15 10:44:10 2020 +0200

    test_storage: Add journal behavior coverage for origin-visit-*add
    
    This was missing some coverage on origin-visit-add and origin-visit-status-add
    for the journal part.
    
    Related to T2310

commit 874da2dee1957ac5e9f5b17a81e11d9d9e8690f0
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sat Jun 13 08:37:57 2020 +0200

    Start migrating the validate proxy toward using BaseModel objects
    
    This will allow to progress incrementally towards removing it.
    
    When it allows to use BaseModel objects everywhere (and tests in test_storage
    are adapted to use this property), it will be time to remove it entirely (as
    it's only used in test).
    
    It's preparatory work for future diffs.

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

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/storage/tests/test_storage.py
1643–1646

use attr.evolve

1649

and visit_status = visit.to_dict() here

1658

and remove the .from_dict here

This revision is now accepted and ready to land.Jun 15 2020, 11:36 AM
swh/storage/tests/test_storage.py
1646–1647

ok on your remarks, i'll need to_dict here then, that'd be less code indeed ;)

Adapt according to review

Also add a call to origin-visit-add to demonstrate its backend and journal
behavior (this on conflict, ignores the duplicates, but still send objects to
the journal)

Build is green

Patch application report for D3279 (id=11627)

Could not rebase; Attempt merge onto 33efdb0dd4...

Updating 33efdb0..46a7839
Fast-forward
 swh/storage/tests/test_storage.py | 175 +++++++++++++++-----------------------
 swh/storage/validate.py           |  32 ++++---
 2 files changed, 92 insertions(+), 115 deletions(-)
Changes applied before test
commit 46a78391ea46281619f6d39028b285e3450e9cde
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jun 15 10:44:10 2020 +0200

    test_storage: Add journal behavior coverage for origin-visit-*add
    
    This was missing some coverage on origin-visit-add and origin-visit-status-add
    for the journal part.
    
    Related to T2310

commit 874da2dee1957ac5e9f5b17a81e11d9d9e8690f0
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sat Jun 13 08:37:57 2020 +0200

    Start migrating the validate proxy toward using BaseModel objects
    
    This will allow to progress incrementally towards removing it.
    
    When it allows to use BaseModel objects everywhere (and tests in test_storage
    are adapted to use this property), it will be time to remove it entirely (as
    it's only used in test).
    
    It's preparatory work for future diffs.

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