Page MenuHomeSoftware Heritage

Prefix task types used in tests with 'test-'
ClosedPublic

Authored by douardda on Feb 8 2022, 5:34 PM.

Details

Summary

so that tests do not depend on a lucky guess on what the scheduler db
state actually is. DB initialization scripts do create task types for
git, hg and svn (used in tests) but these tests depends on the fact the
db fixture has been called already once before, so tables are
truncated (especially the task and task_type ones).

For example running a single test involved in task-type creation was
failing (eg. 'pytest swh -k test_create_task_type_idempotence').

This commit does make tests not collide with any existing task or task
type initialization scripts may create.

Note that this also means that there is actually no test dealing with
the scheduler db state after initialization, which is not grat and
should be addressed.

Diff Detail

Event Timeline

Build is green

Patch application report for D7125 (id=25839)

Rebasing onto 9f601f56d8...

Current branch diff-target is up to date.
Changes applied before test
commit c46ffadf7adf24c7eb3ffce062e8ade3818c79cc
Author: David Douard <david.douard@sdfa3.org>
Date:   Tue Feb 8 17:26:17 2022 +0100

    Prefix task types used in tests with 'test-'
    
    so that tests do not depend on a lucky guess on what the scheduler db
    state actually is. DB initialization scripts do create task types for
    git, hg and svn (used in tests) but these tests depends on the fact the
    db fixture has been called already once before, so tables are
    truncated (especially the task and task_type ones).
    
    For example running a single test involved in task-type creation was
    failing (eg. 'pytest swh -k test_create_task_type_idempotence').
    
    This commit does make tests not collide with any existing task or task
    type initialization scripts may create.
    
    Note that this also means that there is actually no test dealing with
    the scheduler db state after initialization, which is not grat and
    should be addressed.

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

This revision is now accepted and ready to land.Feb 8 2022, 5:42 PM