Page MenuHomeSoftware Heritage

Rework unit testing framework and add more tests
ClosedPublic

Authored by haltode on Oct 12 2020, 3:37 PM.

Details

Summary
  • API data generation script can now easily prefetch content raw data, revision parents, etc.
  • Use the Rust compiler as testing repository (contains more corner case, such as submodules)
  • Add more tests for revisions, metadatas, submodules

Diff Detail

Repository
rDFUSE FUSE virtual file system
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 D4235 (id=14945)

Rebasing onto 6fb734ddef...

Current branch diff-target is up to date.
Changes applied before test
commit c9965062be27b27a0de061f2442fb103f20487ab
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 15:22:03 2020 +0200

    tests: add unit tests for submodules

commit 28b27cbfc1a3f7cd436aeb09d662587bf3886df1
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:58:45 2020 +0200

    tests: add unit tests for metadata

commit 7c8feab856ed7a7140f607c270bb3de945b7111e
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:51:05 2020 +0200

    tests: rework unit test framework
    
    - API data generation script can now easily prefetch content raw data,
      revision parents, etc.
    - Use the Rust compiler as testing repository (contains more corner
      case, such as submodules)

commit c8c1a2c80bd87932e7d447d95e822cbcd5dace00
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:51:14 2020 +0200

    fs: artifact: fix Content uninitialized field

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

Build is green

Patch application report for D4235 (id=14951)

Rebasing onto 6fb734ddef...

Current branch diff-target is up to date.
Changes applied before test
commit 8d787899a3f446d034bb550c28bfc9473119ccb5
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 15:22:03 2020 +0200

    tests: add unit tests for submodules

commit a5375a92d6415dcd6a17a73555706d41bb06b600
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:58:45 2020 +0200

    tests: add unit tests for metadata

commit 2e8a046491f29e2c131333cdd672786136eade98
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:51:05 2020 +0200

    tests: rework unit test framework
    
    - API data generation script can now easily prefetch content raw data,
      revision parents, etc.
    - Use the Rust compiler as testing repository (contains more corner
      case, such as submodules)

commit c8c1a2c80bd87932e7d447d95e822cbcd5dace00
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:51:14 2020 +0200

    fs: artifact: fix Content uninitialized field

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

seirl requested changes to this revision.Oct 12 2020, 4:14 PM
seirl added a subscriber: seirl.
seirl added inline comments.
swh/fuse/tests/common.py
19–22 ↗(On Diff #14951)

This entire function can just be replaced by writing directly in the test code:

assert path.read_text() == expected

swh/fuse/tests/conftest.py
74 ↗(On Diff #14951)

Why don't you yield a Path() here? that would allow you to use the slash notation everywhere else, instead of reconstructing paths all the time.

This revision now requires changes to proceed.Oct 12 2020, 4:14 PM

Small code clean up:

  • remove assert_file_content
  • remove unnecessary Path construction

Build is green

Patch application report for D4235 (id=14953)

Rebasing onto 6fb734ddef...

Current branch diff-target is up to date.
Changes applied before test
commit ac3460e0151bb2a30fc65b2b000aca69ab176042
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 16:19:43 2020 +0200

    tests: small code clean up

commit 8d787899a3f446d034bb550c28bfc9473119ccb5
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 15:22:03 2020 +0200

    tests: add unit tests for submodules

commit a5375a92d6415dcd6a17a73555706d41bb06b600
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:58:45 2020 +0200

    tests: add unit tests for metadata

commit 2e8a046491f29e2c131333cdd672786136eade98
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:51:05 2020 +0200

    tests: rework unit test framework
    
    - API data generation script can now easily prefetch content raw data,
      revision parents, etc.
    - Use the Rust compiler as testing repository (contains more corner
      case, such as submodules)

commit c8c1a2c80bd87932e7d447d95e822cbcd5dace00
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:51:14 2020 +0200

    fs: artifact: fix Content uninitialized field

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

seirl added inline comments.
swh/fuse/tests/test_directory.py
1 ↗(On Diff #14953)

nit: we generally keep the namespace for this kind of functions

This revision is now accepted and ready to land.Oct 12 2020, 6:30 PM

Keep os functions namespace

Build is green

Patch application report for D4235 (id=14981)

Rebasing onto 6fb734ddef...

Current branch diff-target is up to date.
Changes applied before test
commit 464154eaf68f7eb063aef9af2ca7a82e1edb946b
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 16:19:43 2020 +0200

    tests: small code clean up

commit 8d787899a3f446d034bb550c28bfc9473119ccb5
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 15:22:03 2020 +0200

    tests: add unit tests for submodules

commit a5375a92d6415dcd6a17a73555706d41bb06b600
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:58:45 2020 +0200

    tests: add unit tests for metadata

commit 2e8a046491f29e2c131333cdd672786136eade98
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:51:05 2020 +0200

    tests: rework unit test framework
    
    - API data generation script can now easily prefetch content raw data,
      revision parents, etc.
    - Use the Rust compiler as testing repository (contains more corner
      case, such as submodules)

commit c8c1a2c80bd87932e7d447d95e822cbcd5dace00
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:51:14 2020 +0200

    fs: artifact: fix Content uninitialized field

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

Rebase on master and use on the fly mounting

Build is green

Patch application report for D4235 (id=14990)

Rebasing onto 7e0c9de5b6...

Current branch diff-target is up to date.
Changes applied before test
commit de84c9de3a4f30556942f83e517bdc50ae0c7d5b
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 16:19:43 2020 +0200

    tests: small code clean up

commit c82f17e3990ccc209b69002684600cd1b85438d1
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 15:22:03 2020 +0200

    tests: add unit tests for submodules

commit e9b26e6efd3652cfda7856c0d3b22377775dcd0b
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:58:45 2020 +0200

    tests: add unit tests for metadata

commit c71329d1be77321196dc739c2e522996a5541ef4
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:51:05 2020 +0200

    tests: rework unit test framework
    
    - API data generation script can now easily prefetch content raw data,
      revision parents, etc.
    - Use the Rust compiler as testing repository (contains more corner
      case, such as submodules)
    - Mount test artifacts on the fly

commit 201872fdebe577a9ce34afabb17ea49f79204f45
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 12 14:51:14 2020 +0200

    fs: artifact: fix Content uninitialized field

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