Page MenuHomeSoftware Heritage

tests: Improve coverage on `directory_ls` endpoints
ClosedPublic

Authored by ardumont on Aug 4 2020, 12:55 PM.

Details

Summary

Prior to this commit, when listing a directory, we did not check up to the
contents. This fixes it.

This also fixes one inconsistent test data and the tests impacted by this
change.

Detected in D3692

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 D3694 (id=13012)

Could not rebase; Attempt merge onto 3c2e5a3d7d...

Updating 3c2e5a3d..211132f8
Fast-forward
 swh/storage/cassandra/storage.py    |  27 ++--
 swh/storage/db.py                   |  29 ++--
 swh/storage/in_memory.py            |  22 ++-
 swh/storage/interface.py            |  12 +-
 swh/storage/storage.py              |  15 +-
 swh/storage/tests/storage_data.py   |   2 +-
 swh/storage/tests/test_cassandra.py |   4 +-
 swh/storage/tests/test_storage.py   | 267 +++++++++++++++++-------------------
 8 files changed, 179 insertions(+), 199 deletions(-)
Changes applied before test
commit 211132f825d2c9dcb8792e805d273f991412027c
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Aug 4 12:40:24 2020 +0200

    tests: Improve coverage on directory_ls endpoints
    
    Prior to this commit, when listing a directory, we did not check up to the
    contents. This fixes it.
    
    This also fixes one inconsistent test data and the tests impacted by this
    change.

commit 15e8c996d44108a6557973724f7b25940be85d4f
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Aug 4 10:06:50 2020 +0200

    storage*: Type content_find(...) -> List[Content]
    
    Related to T645

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

swh/storage/tests/storage_data.py
168

smells like a typo (oops ;)

swh/storage/tests/test_storage.py
656

dropped it, not clear plus it does not work when we go down to contents.

672

we also have contents now so no longer working as it.
on previous discussion, we agreed the order is not relevant either, so just checking the presence is enough.

676

, recursive=False), no need, i'll drop it.

694

dropped it, not the concerns of this test.

729

same

Drop unneeded modification

Unify second directory_ls assertion checks and drop no longer needed (nor
working) utility method

Build is green

Patch application report for D3694 (id=13013)

Could not rebase; Attempt merge onto 3c2e5a3d7d...

Updating 3c2e5a3d..7b25642d
Fast-forward
 swh/storage/cassandra/storage.py    |  27 ++--
 swh/storage/db.py                   |  29 ++--
 swh/storage/in_memory.py            |  22 ++-
 swh/storage/interface.py            |  12 +-
 swh/storage/storage.py              |  15 +-
 swh/storage/tests/storage_data.py   |   2 +-
 swh/storage/tests/test_cassandra.py |   4 +-
 swh/storage/tests/test_storage.py   | 265 +++++++++++++++++-------------------
 8 files changed, 178 insertions(+), 198 deletions(-)
Changes applied before test
commit 7b25642d71f3c63135131d307615254e8bb569bd
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Aug 4 12:40:24 2020 +0200

    tests: Improve coverage on directory_ls endpoints
    
    Prior to this commit, when listing a directory, we did not check up to the
    contents. This fixes it.
    
    This also fixes one inconsistent test data and the tests impacted by this
    change.

commit 15e8c996d44108a6557973724f7b25940be85d4f
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Aug 4 10:06:50 2020 +0200

    storage*: Type content_find(...) -> List[Content]
    
    Related to T645

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

ardumont retitled this revision from tests: Improve coverage on directory_ls endpoints to tests: Improve coverage on `directory_ls` endpoints.
ardumont edited the summary of this revision. (Show Details)

Build is green

Patch application report for D3694 (id=13014)

Could not rebase; Attempt merge onto 3c2e5a3d7d...

Updating 3c2e5a3d..54cf6797
Fast-forward
 swh/storage/cassandra/storage.py    |  27 ++--
 swh/storage/db.py                   |  29 ++--
 swh/storage/in_memory.py            |  22 ++-
 swh/storage/interface.py            |  12 +-
 swh/storage/storage.py              |  15 +-
 swh/storage/tests/storage_data.py   |   2 +-
 swh/storage/tests/test_cassandra.py |   4 +-
 swh/storage/tests/test_storage.py   | 278 +++++++++++++++++-------------------
 8 files changed, 184 insertions(+), 205 deletions(-)
Changes applied before test
commit 54cf6797e0298891198e28d20744148ece4585d9
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Aug 4 12:40:24 2020 +0200

    tests: Improve coverage on directory_ls endpoints
    
    Prior to this commit, when listing a directory, we did not check up to the
    contents. This fixes it.
    
    This also fixes one inconsistent test data and the tests impacted by this
    change.

commit 15e8c996d44108a6557973724f7b25940be85d4f
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Aug 4 10:06:50 2020 +0200

    storage*: Type content_find(...) -> List[Content]
    
    Related to T645

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

This revision is now accepted and ready to land.Aug 4 2020, 1:24 PM
vlorentz added a subscriber: vlorentz.

s/up to the contents/down to contents/ in your commit message

swh/storage/tests/test_storage.py
58–60

I find this hard to understand. What about this?

"""Iterate through a directory's entries, and yields the items 'directory_ls'
is expected to return; including content metadata for file entries"""

swh/storage/tests/test_storage.py
58–60

+1

(i was currently reflecting on how to improve this ;)

Adapt according to review:

  • Rework commit message
  • Improve docstring

Build is green

Patch application report for D3694 (id=13017)

Rebasing onto 15e8c996d4...

Current branch diff-target is up to date.
Changes applied before test
commit a5232b7a7bcd8e6727876eab907024ea9da55f0b
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Aug 4 12:40:24 2020 +0200

    tests: Improve coverage on directory_ls endpoints
    
    This fixes the current directory listing tests coverage to check down to the
    contents.
    
    This also fixes one inconsistent test data and the tests impacted by this
    change.

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