debian.tests: Fix test

The scheduler fixture introduced truncates tables in between tests. The debian
tests unfortunately share state and it broke when that changed. This fixes the
test by avoiding the truncation of the scheduler db table "task".

Ideally those tests need to be reworked to avoid sharing state between tests.

[1] https://jenkins.softwareheritage.org/job/DLS/job/tests/1043
This commit is contained in:
Antoine R. Dumont (@ardumont) 2020-10-29 22:09:32 +01:00
parent a19cb5fb51
commit e2a861c801
No known key found for this signature in database
GPG key ID: 52E2E9840D10C3B8

View file

@ -3,13 +3,32 @@
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import os
import pytest
from pytest_postgresql.janitor import DatabaseJanitor
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from swh.core.db.pytest_plugin import postgresql_fact
from swh.lister.core.models import SQLBase
from swh.lister.debian import debian_init
import swh.scheduler
SQL_DIR = os.path.join(os.path.dirname(swh.scheduler.__file__), "sql")
postgresql_scheduler = postgresql_fact(
"postgresql_proc",
db_name="scheduler-lister",
dump_files=os.path.join(SQL_DIR, "*.sql"),
# do not truncate the task tables, it's required in between test
no_truncate_tables={"dbversion", "priority_ratio", "task"},
)
@pytest.fixture
def swh_scheduler_config(postgresql_scheduler):
return {"db": postgresql_scheduler.dsn}
@pytest.fixture