Page MenuHomeSoftware Heritage

Stop relying on origin ids unless necessary.
ClosedPublic

Authored by vlorentz on Jul 4 2019, 5:03 PM.

Details

Summary

This completely stops using origin ids, except when an endpoint that depends
on origin ids is used.

Related: D1690

Test Plan
# Test with origin ids
pytest --hypothesis-profile=swh-web-fast swh/web/

# Disable origin ids
cd ../swh-storage/
arc patch D1690
cd ../swh-web/

# Test without origin ids (and disable tests that require origin ids)
SWH_STORAGE_IN_MEMORY_ENABLE_ORIGIN_IDS=false pytest --hypothesis-profile=swh-web-fast swh/web/ -m "not origin_id"

Diff Detail

Repository
rDWAPPS Web applications
Branch
optional-origin-ids
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 6718
Build 9385: tox-on-jenkinsJenkins
Build 9384: arc lint + arc unit

Event Timeline

vlorentz edited the test plan for this revision. (Show Details)

sed "s/ENABLE_ORIGIN_IDS = True/ENABLE_ORIGIN_IDS = False/" swh/storage/in_memory.py

why don't you make it a configuration option?

use a config var instead of sed

anlambert added a subscriber: anlambert.

Looks good to me. FYI, pytest is printing the following warning:

PytestUnknownMarkWarning: Unknown pytest.mark.origin_id - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html

The new marker needs to be explicitely declared in the pytest.ini file to remove the warning:

markers =
  origin_id: execute tests using an origin id (deselect with '-m "not origin_id"')
swh/web/common/service.py
957

Here, I would prefer to put the test inside parenthesis instead of using backslashes:

if ('origin_url' in revision and
            'branch_name' in revision and
            'ts' in revision and
            'sha1_git' in revision):
        return lookup_revision_with_context_by(revision['origin_url'],
                                               revision['branch_name'],
                                               revision['ts'],
                                               revision['sha1_git'],
                                               limit)
This revision is now accepted and ready to land.Jul 8 2019, 11:48 AM
  • rebase
  • reformat
  • hide pytest warning
This revision was automatically updated to reflect the committed changes.