Page MenuHomeSoftware Heritage

Add stream_results_optional
ClosedPublic

Authored by vlorentz on Jul 30 2021, 3:57 PM.

Details

Summary

It's needed to properly read from storage.directory_get_entries,
which returns None instead of empty iterators when a directory
is not found (so clients can tell the difference with the empty
directory without hardcoding its hash).

Diff Detail

Repository
rDCORE Foundations and core functionalities
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 D6047 (id=21873)

Rebasing onto 02bf96407f...

Current branch diff-target is up to date.
Changes applied before test
commit c01a6068f498fb7a1436e07149c3ce5d47c74ca5
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Jul 30 15:57:20 2021 +0200

    Add stream_results_optional
    
    It's needed to properly read from storage.directory_get_entries,
    which returns None instead of empty iterators when a directory
    is not found (so clients can tell the difference with the empty
    directory without hardcoding its hash).

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

ardumont added inline comments.
swh/core/api/classes.py
49

should be simple enough to add both missing conditional test in there. Can you please do it at the same time?

looks sound to me, i'd add the 2 missing tests (which ensure we don't call stream_result* with page_token) since we are touching that part.

add test_stream_results_kwarg

Build is green

Patch application report for D6047 (id=21874)

Rebasing onto 02bf96407f...

Current branch diff-target is up to date.
Changes applied before test
commit 1182e126a53a03e72d34f3135ed1b0211a3bbf75
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Jul 30 15:57:20 2021 +0200

    Add stream_results_optional
    
    It's needed to properly read from storage.directory_get_entries,
    which returns None instead of empty iterators when a directory
    is not found (so clients can tell the difference with the empty
    directory without hardcoding its hash).

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

oops I didn't mean to commit this yet

Build is green

Patch application report for D6047 (id=21875)

Rebasing onto 02bf96407f...

Current branch diff-target is up to date.
Changes applied before test
commit 3337e79642e01f28abff732fa91a3a8c2faf6e6a
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Jul 30 15:57:20 2021 +0200

    Add stream_results_optional
    
    It's needed to properly read from storage.directory_get_entries,
    which returns None instead of empty iterators when a directory
    is not found (so clients can tell the difference with the empty
    directory without hardcoding its hash).

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

This revision is now accepted and ready to land.Jul 30 2021, 4:41 PM
This revision was automatically updated to reflect the committed changes.