Page MenuHomeSoftware Heritage

pytest_plugin: Change dbname to storage to avoid clash in tests
ClosedPublic

Authored by ardumont on Sep 23 2020, 11:44 AM.

Details

Summary

Other similar fixtures in other modules which use the same "tests" db already.
Clash can then happen when table names exists in different modules (e.g.
dbversion exists both in scheduler and storage dbs).

Technically, that renames the db used by tests from "tests" to "storage".

Related to P773

Test Plan

tox

Diff Detail

Repository
rDSTO Storage manager
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15426
Build 23765: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 23764: arc lint + arc unit

Event Timeline

swh/storage/pytest_plugin.py
27

postgresql_proc is no longer needed...

Build is green

Patch application report for D4014 (id=14162)

Rebasing onto 30cdb78f17...

Current branch diff-target is up to date.
Changes applied before test
commit b30f611a4852e9442fc8cce1ac743ffb031bda9a
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed Sep 23 11:04:43 2020 +0200

    pytest_plugin: Change dbname to swh-storage to avoid clash in tests
    
    Other similar fixtures in other modules which use the same "tests" db already.
    Clash can then happen when table names exists in different modules (e.g.
    dbversion exist both in scheduler and storage dbs).

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

swh/storage/pytest_plugin.py
91

I'd like to move the postgresql_fact and the following instruction up, before swh_storage_backend_config so it's clearer...

ardumont retitled this revision from pytest_plugin: Change dbname to swh-storage to avoid clash in tests to pytest_plugin: Change dbname to storage to avoid clash in tests.Sep 23 2020, 11:51 AM
ardumont edited the summary of this revision. (Show Details)
ardumont edited the summary of this revision. (Show Details)
ardumont added a project: Storage manager.
  • Drop unneeded postgresql_proc

it's unclear to me if the hunk in swh_storage_backend_config is related with the fix or not.
isn't the very last diff hunk enough for the job?

I mean I'm against the remaining / simplification proposed here, it's just they look unrelated with the fix to me.

Build is green

Patch application report for D4014 (id=14164)

Rebasing onto 30cdb78f17...

Current branch diff-target is up to date.
Changes applied before test
commit 6a093d03f70cf79e014a6180386520eb12508a99
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed Sep 23 11:04:43 2020 +0200

    pytest_plugin: Change dbname to storage to avoid clash in tests
    
    Other similar fixtures in other modules which use the same "tests" db already.
    Clash can then happen when table names exists in different modules (e.g.
    dbversion exist both in scheduler and storage dbs).

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

it's unclear to me if the hunk in swh_storage_backend_config is related with the fix or not.

it is to avoid hard-coding twice the "storage" dbname in the original chunk.

swh/storage/pytest_plugin.py
38

simplification to avoid hard-coding the dbname="storage" here...
also this unifies with how it's actually configured in the scheduler fixture as well (using .dsn).

swh/storage/pytest_plugin.py
91
swh/storage/pytest_plugin.py
69

that, i can revert.
i think i misunderstood your initial question.

Rename tests db to "storage"

Build is green

Patch application report for D4014 (id=14167)

Could not rebase; Attempt merge onto 30cdb78f17...

Updating 30cdb78f..6286e186
Fast-forward
 swh/storage/pytest_plugin.py | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
Changes applied before test
commit 6286e186ee08a3e68f332f19d512453d62f56c70
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed Sep 23 11:04:43 2020 +0200

    pytest_plugin: Change dbname to storage to avoid clash in tests
    
    Other similar fixtures in other modules which use the same "tests" db already.
    Clash can then happen when table names exists in different modules (e.g.
    dbversion exist both in scheduler and storage dbs).

commit 8c44a29e432f5edb6d5229415067e100a0aac523
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed Sep 23 12:24:04 2020 +0200

    pytest_plugin: Reuse swh_storage_postgresql connection string
    
    The `swh_storage_postgresql.dsn` string already contains the connection
    information necessary for the tests to run.

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

This revision is now accepted and ready to land.Sep 23 2020, 1:11 PM