Page MenuHomeSoftware Heritage

deposit.cli: Warn users when missing origin tags are detected
ClosedPublic

Authored by ardumont on Jan 25 2021, 12:33 PM.

Details

Summary

This explicitely checks for the presence of swh:origin_to_add or swh:create_origin
within the provided metadata file.

If not present, this logs a warning about it.

Related to T2860

Diff Detail

Repository
rDDEP Push deposit
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 D4936 (id=17551)

Rebasing onto b65694973e...

Current branch diff-target is up to date.
Changes applied before test
commit 3eb7840a32eec961d072b2a8807a08bd0c110855
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jan 25 12:32:15 2021 +0100

    deposit.cli: Warn users when missing origin tags are detected
    
    This explicitely checks for the presence of swh:origin_to_add or swh:create_origin
    within the provided metadata file.
    
    If not present, this logs a warning about it.
    
    Related to T2860

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

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/deposit/cli/client.py
262–265
swh/deposit/tests/cli/test_client.py
878
910–945

merge this with the regular tests; and check there is no log with level >= WARNING at all, that's an even better test.

This revision now requires changes to proceed.Jan 25 2021, 3:44 PM

Thanks for the suggestions, will do.

swh/deposit/tests/cli/test_client.py
910–945

it's the other way around: 40 -> error, 30 -> warning, 20 -> info, ...
but ok :)

Build is green

Patch application report for D4936 (id=17587)

Rebasing onto b65694973e...

Current branch diff-target is up to date.
Changes applied before test
commit c841f8b473594f6748d933dfe57bb815ac3a8bf1
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jan 25 12:32:15 2021 +0100

    deposit.cli: Warn users when missing origin tags are detected
    
    This explicitely checks for the presence of swh:origin_to_add or swh:create_origin
    within the provided metadata file.
    
    If not present, this logs a warning about it.
    
    Related to T2860

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

sorry, I didn't mean merging the non-error test with the error test, but to merge the non-error assertion with other tests (ie. the one that already don't trigger errors)

sorry, I didn't mean merging the non-error test with the error test, but to merge the non-error assertion with other tests (ie. the one that already don't trigger errors)

the funny thing is that i understood it that way initially...
got distracted..,
came back here....
and made a mess ¯\_(ツ)_/¯

sorry, I didn't mean merging the non-error test with the error test, but to merge the non-error assertion with other tests (ie. the one that already don't trigger errors)

the funny thing is that i understood it that way initially...
got distracted..,
came back here....
and made a mess ¯\_(ツ)_/¯

What you suggest sounds good but it's hellishly annoying to do in the current state...
so not right now...

swh/deposit/cli/client.py
130–131

Found a bug!

it's missing the ['swh:deposit'] level.

Adapt according to review

Only adapted 2 nominal scenarios with it.

I kept the last failing scenario as it also tests the add_to_origin (and we had none
about it yet)

This caught a bug in the metadata generation about the <create_origin> case. It was
missing the swh:deposit level.

Build is green

Patch application report for D4936 (id=17680)

Rebasing onto b65694973e...

Current branch diff-target is up to date.
Changes applied before test
commit 4deee5ba948ba6cb6760772b235371eace4c9690
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jan 25 12:32:15 2021 +0100

    deposit.cli: Warn users when missing origin tags are detected
    
    This explicitely checks for the presence of swh:origin_to_add or swh:create_origin
    within the provided metadata file.
    
    If not present, this logs a warning about it.
    
    Related to T2860

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

This revision is now accepted and ready to land.Feb 1 2021, 3:51 PM