Page MenuHomeSoftware Heritage

Install postgresql_fact fixture for faster postgres tests
ClosedPublic

Authored by ardumont on Oct 19 2020, 10:04 AM.

Details

Summary

This moves the SWHDatabaseJanitor from swh.storage to swh.core. This also adds
tests to it.

This will allow to share the faster behavior on other swh services with
postgres backends (vault, scheduler, etc...).

Test Plan

tox

Diff Detail

Repository
rDCORE Foundations and core functionalities
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 D4300 (id=15188)

Could not rebase; Attempt merge onto 1657fb827f...

Updating 1657fb8..4d11b30
Fast-forward
 mypy.ini                                           |   3 +
 requirements-db.txt                                |   1 +
 requirements-test-db.txt                           |   2 +-
 swh/core/api/asynchronous.py                       | 128 +++++++++++++++++---
 swh/core/api/tests/conftest.py                     |   3 +
 swh/core/api/tests/test_async.py                   |  38 +++---
 swh/core/api/tests/test_rpc_server_asynchronous.py | 132 +++++++++++++++++++++
 swh/core/db/db_utils.py                            | 104 +++++++++++++++-
 swh/core/db/pytest_plugin.py                       |  59 +++++++++
 swh/core/db/tests/conftest.py                      |   2 +
 swh/core/db/tests/data/0-schema.sql                |  13 ++
 swh/core/db/tests/data/1-data.sql                  |  10 ++
 swh/core/db/tests/test_db_utils.py                 |  56 +++++++++
 tox.ini                                            |   1 +
 14 files changed, 509 insertions(+), 43 deletions(-)
 create mode 100644 swh/core/api/tests/conftest.py
 create mode 100644 swh/core/api/tests/test_rpc_server_asynchronous.py
 create mode 100644 swh/core/db/pytest_plugin.py
 create mode 100644 swh/core/db/tests/data/0-schema.sql
 create mode 100644 swh/core/db/tests/data/1-data.sql
 create mode 100644 swh/core/db/tests/test_db_utils.py
Changes applied before test
commit 4d11b3055cfea7f9271d02dff9940c9cf13b67d5
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sun Oct 18 14:46:39 2020 +0200

    Install postgresql_fact fixture for faster postgres tests
    
    This moves the SWHDatabaseJanitor from swh.storage to swh.core. This also adds
    tests to it.
    
    This will allow to share the behavior on other swh services with postgres
    backends (vault, scheduler, etc...).

commit 604a08cbe80439b35ce0197805b6a4c536d96e62
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sat Oct 17 19:06:57 2020 +0200

    asynchronous.RPCServerApp: Align implementation with api.RPCServerApp
    
    This will allow to align the Vault's client/server code with the other rpc
    servers. And start adding one typed interface with more consistent checks in
    between implementations.

commit 7f928a07d91460efbbfbc6c5264a4fdd60e58be2
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sun Oct 18 10:25:01 2020 +0200

    api.tests.test_async: Simplify fixture setup

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

vlorentz added inline comments.
swh/core/db/db_utils.py
322

not covered, according to phab

swh/core/db/db_utils.py
322

yes, i'm gonna look at how to add sequence in there.

Test the sequences are reset as well

Build is green

Patch application report for D4300 (id=15219)

Rebasing onto 7f928a07d9...

Current branch diff-target is up to date.
Changes applied before test
commit 966a40142e23d8e6a258991055e65392e9acd3f7
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sun Oct 18 14:46:39 2020 +0200

    Install postgresql_fact fixture for faster postgres tests
    
    This moves the SWHDatabaseJanitor from swh.storage to swh.core. This also adds
    tests to it.
    
    This will allow to share the behavior on other swh services with postgres
    backends (vault, scheduler, etc...).

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

  • Fix typo in docstring
  • Add other dostrings

Build is green

Patch application report for D4300 (id=15234)

Rebasing onto 7f928a07d9...

Current branch diff-target is up to date.
Changes applied before test
commit 6b311c8f7794a548c68c786e5adb79dff609843a
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sun Oct 18 14:46:39 2020 +0200

    Install postgresql_fact fixture for faster postgres tests
    
    This moves the SWHDatabaseJanitor from swh.storage to swh.core. This also adds
    tests to it.
    
    This will allow to share the behavior on other swh services with postgres
    backends (vault, scheduler, etc...).

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

Build is green

Patch application report for D4300 (id=15287)

Rebasing onto 7f928a07d9...

Current branch diff-target is up to date.
Changes applied before test
commit 0c01f4a09284b8843ac238f61f0a9f3ba3a0cd7a
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sun Oct 18 14:46:39 2020 +0200

    Install postgresql_fact fixture for faster postgres tests
    
    This moves the SWHDatabaseJanitor from swh.storage to swh.core. This also adds
    tests to it.
    
    This will allow to share the behavior on other swh services with postgres
    backends (vault, scheduler, etc...).

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

This revision is now accepted and ready to land.Oct 22 2020, 10:53 AM