Page MenuHomeSoftware Heritage

Improve tests
ClosedPublic

Authored by douardda on Mar 30 2021, 5:33 PM.

Details

Summary
  • ensure the actual values (sha1 and path) are correct instead of just counting the rows in the database,
  • rename test_provenance_db() as test_probenance_heuristics()
  • rename synthetic result test files including both heuristic 'arguments' in the file name, aka:
    • synthetic_noroot_upper.txt -> synthetic_upper_1.txt
    • synthetic_noroot_lower.txt -> synthetic_lower_1.txt
  • add synthetic test files for the mindepth=2 heuristic

Depends on D5388

Diff Detail

Repository
rDPROV Provenance database
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 D5389 (id=19292)

Could not rebase; Attempt merge onto 4a5a99ea7d...

Updating 4a5a99e..25bf2a1
Fast-forward
 swh/provenance/archive.py                          |   6 +-
 swh/provenance/cli.py                              |   2 +-
 swh/provenance/model.py                            |  83 ++++++++---
 swh/provenance/origin.py                           |  53 ++------
 swh/provenance/postgresql/archive.py               |   6 +-
 swh/provenance/provenance.py                       |  62 ++++++---
 swh/provenance/revision.py                         |  44 +-----
 swh/provenance/storage/archive.py                  |  10 +-
 swh/provenance/tests/conftest.py                   | 126 ++++++++++++++++-
 swh/provenance/tests/data/synthetic_lower_1.txt    |  91 +++++++++++++
 swh/provenance/tests/data/synthetic_lower_2.txt    |  91 +++++++++++++
 swh/provenance/tests/data/synthetic_upper_1.txt    |  92 +++++++++++++
 swh/provenance/tests/data/synthetic_upper_2.txt    |  91 +++++++++++++
 swh/provenance/tests/test_provenance_db.py         | 151 +++++++++++++++++++--
 swh/provenance/tests/test_provenance_db_storage.py |  21 +++
 15 files changed, 783 insertions(+), 146 deletions(-)
 create mode 100644 swh/provenance/tests/data/synthetic_lower_1.txt
 create mode 100644 swh/provenance/tests/data/synthetic_lower_2.txt
 create mode 100644 swh/provenance/tests/data/synthetic_upper_1.txt
 create mode 100644 swh/provenance/tests/data/synthetic_upper_2.txt
 create mode 100644 swh/provenance/tests/test_provenance_db_storage.py
Changes applied before test
commit 25bf2a193e02f5de38e208f65822169f4ed91af9
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 17:09:47 2021 +0200

    Add synthetic test files for the mindepth=2 heuristic
    
    Note: timestamps have not been checked (but these are actually not
          used in current test implementation).

commit 65d745352af1f789d4233ede7ec63775b072be23
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 17:07:59 2021 +0200

    Improve and rename test_provenance_db() as test_probenance_heuristics()
    
    instead of just counting the rows in the database, ensure the actual
    values (sha1 and path) are correct.

commit e83f0a2fd16a72307361295680b3339e3c47591f
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 17:01:56 2021 +0200

    Rename synthetic result test files
    
    including both heuristic 'arguments' in the file name, aka:
    
    - synthetic_noroot_upper.txt -> synthetic_upper_1.txt
    - synthetic_noroot_lower.txt -> synthetic_lower_1.txt

commit 76bac6633c479ba1c98f8b485e1143e263739670
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 15:24:21 2021 +0200

    Also test the provenance db with ArchiveStorage
    
    in addition to the ArchivePostgreSQL implementation.

commit 9583d0348f9013295f201944d63b69328fc87fd7
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 14:49:38 2021 +0200

    Refactor the model
    
    - move all *Entry model classes in model.py,
    - kill the useless TreeEntry base class,
    - do not keep the archive instance as instance attribute of model
      objects, instead
    - implement "iterators" as explicit methods taking an ArchiveInterface
      object as argument,
    - refactor the code in provenance.py accordingly.

commit e97d2e2473efd39e08018914606438fd5e91b91d
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 12:01:07 2021 +0200

    Simplify a bit origin.py
    
    - kill the useless OriginIterator class,
    - remove commented thread locks

commit 88c3910d2da58cc4167fb72b7ec530eec51cad8b
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Mar 25 15:01:35 2021 +0100

    Add a test for the (noroot, upper) case

commit 5d3f925e42530de891d94041046b2aec66d182c3
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Mar 24 09:49:11 2021 +0100

    Add a test to compare the result of revision_add() with known results
    
    Use a 'synthetic' file to describe the expected behavior of the
    insertion of revisions in the provenance index.

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

Why .hex() everywhere? Does swh-provenance use hex strings internally?

Why .hex() everywhere? Does swh-provenance use hex strings internally?

To make debugging easier, doing so, the failed assertion shows inequalities (of sets) with hex representations of sha1s, which is then easier to match with the content of "synthetic" files.

This revision is now accepted and ready to land.Mar 30 2021, 11:40 PM

hmm, leaving it up for review by zack and grouss

This revision now requires review to proceed.Mar 30 2021, 11:40 PM

Build is green

Patch application report for D5389 (id=19836)

Could not rebase; Attempt merge onto 62617e5006...

Updating 62617e5..982e2c1
Fast-forward
 swh/provenance/archive.py                          |   6 +-
 swh/provenance/cli.py                              |   2 +-
 swh/provenance/model.py                            |  83 ++++++++---
 swh/provenance/origin.py                           |  53 ++------
 swh/provenance/postgresql/archive.py               |   6 +-
 swh/provenance/provenance.py                       |  62 ++++++---
 swh/provenance/revision.py                         |  44 +-----
 swh/provenance/storage/archive.py                  |  10 +-
 swh/provenance/tests/conftest.py                   | 126 ++++++++++++++++-
 swh/provenance/tests/data/synthetic_lower_1.txt    |  91 +++++++++++++
 swh/provenance/tests/data/synthetic_lower_2.txt    |  91 +++++++++++++
 swh/provenance/tests/data/synthetic_upper_1.txt    |  92 +++++++++++++
 swh/provenance/tests/data/synthetic_upper_2.txt    |  91 +++++++++++++
 swh/provenance/tests/test_provenance_db.py         | 151 +++++++++++++++++++--
 swh/provenance/tests/test_provenance_db_storage.py |  21 +++
 15 files changed, 783 insertions(+), 146 deletions(-)
 create mode 100644 swh/provenance/tests/data/synthetic_lower_1.txt
 create mode 100644 swh/provenance/tests/data/synthetic_lower_2.txt
 create mode 100644 swh/provenance/tests/data/synthetic_upper_1.txt
 create mode 100644 swh/provenance/tests/data/synthetic_upper_2.txt
 create mode 100644 swh/provenance/tests/test_provenance_db_storage.py
Changes applied before test
commit 982e2c1a2a9a036c57ede378881735eb03216bea
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 17:09:47 2021 +0200

    Add synthetic test files for the mindepth=2 heuristic
    
    Note: timestamps have not been checked (but these are actually not
          used in current test implementation).

commit 594490576b0087b7e1f64032b7a2ee7101114d94
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 17:07:59 2021 +0200

    Improve and rename test_provenance_db() as test_probenance_heuristics()
    
    instead of just counting the rows in the database, ensure the actual
    values (sha1 and path) are correct.

commit f2ffd718c4682b12d31cabdc773155cfbbe13bb7
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 17:01:56 2021 +0200

    Rename synthetic result test files
    
    including both heuristic 'arguments' in the file name, aka:
    
    - synthetic_noroot_upper.txt -> synthetic_upper_1.txt
    - synthetic_noroot_lower.txt -> synthetic_lower_1.txt

commit 5e89689ef08b4a437eebca4d2a32834dfa4740dc
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 15:24:21 2021 +0200

    Also test the provenance db with ArchiveStorage
    
    in addition to the ArchivePostgreSQL implementation.

commit a23a33c5a77da059f72835c0400c4384a04b7f64
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 14:49:38 2021 +0200

    Refactor the model
    
    - move all *Entry model classes in model.py,
    - kill the useless TreeEntry base class,
    - do not keep the archive instance as instance attribute of model
      objects, instead
    - implement "iterators" as explicit methods taking an ArchiveInterface
      object as argument,
    - refactor the code in provenance.py accordingly.

commit 7eaeebb6091a13105ddee289fdcf9f70cb367c8e
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Mar 30 12:01:07 2021 +0200

    Simplify a bit origin.py
    
    - kill the useless OriginIterator class,
    - remove commented thread locks

commit 8853314af9817988a58450937c9d25097e66e741
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Mar 25 15:01:35 2021 +0100

    Add a test for the (noroot, upper) case

commit adbc99dd357dc452081df1965805756987b7e09b
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Mar 24 09:49:11 2021 +0100

    Add a test to compare the result of revision_add() with known results
    
    Use a 'synthetic' file to describe the expected behavior of the
    insertion of revisions in the provenance index.

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

This revision was not accepted when it landed; it landed in state Needs Review.Mon, Apr 19, 4:56 PM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.