Page MenuHomeSoftware Heritage

Add testinfra based e2e tests for the deposit

Authored by douardda on Dec 20 2019, 2:32 PM.



These tests create deposit and wait for them to be in the 'done' status.
Warning, this requires testinfra to be available (as well as docker-compose).

Depends on D2489

Diff Detail

rDENV Development environment
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

douardda created this revision.Dec 20 2019, 2:32 PM

that looks quite awesomly promising.

will that replace the current shell scripts?

vlorentz added a subscriber: vlorentz.EditedDec 20 2019, 2:49 PM

You could remove most of the code in your tests by using the code behind the Icinga plugin in D2484. It already handles generating an archive, checking the status periodically, etc. eg. test_create_deposit_simple could be rewritten as:

from swh.icinga_plugins.deposit import DepositCheck

def test_create_deposit_simple(host, sample_metadata, sample_archive):
    config = {
        'metadata': sample_metadata,
        'archive': sample_archive,
        'username': 'test',
        'password': 'test',
        'server': 'http://nginx:5080/deposit/1',
        'collection': 'test',
        'critical': 60,  # in seconds
    deposit_check = DepositCheck(config)
    assert deposit_check.main() == 0

Missing copyright header, and you should split imports into two groups (stdlib vs third-party) (see item 2 of the imports section of PEP 8)


I don't find this name explicit enough. What about docker_deposit?


Let's not make our CI depend on github. You can generate such files yourself easily, see or make the repo tarball its own files when running

that looks quite awesomly promising.

will that replace the current shell scripts?

if it makes consensus, sure.

douardda added inline comments.Dec 20 2019, 2:56 PM

yeah this diff is not really finished yet...


I just used the example from testinfra's doc ;-)


I was sure this would come! 😈

douardda updated this revision to Diff 8909.Jan 8 2020, 4:00 PM

Update/fixes according vlorentz' comments


  • add copyright & fix import order in,
  • do not depend on external service (aka github) for crafting a deposit archive to upload,
  • rename the 'host' fixture as 'deposit_host'.
vlorentz accepted this revision.Jan 8 2020, 4:04 PM
This revision is now accepted and ready to land.Jan 8 2020, 4:04 PM
douardda updated this revision to Diff 8912.Jan 8 2020, 4:51 PM

forgot the renaming of host->deposit_host

This revision was automatically updated to reflect the committed changes.