Skip to content

Reset entire test db before each test #841

@dennisvang

Description

@dennisvang

Many tests in the current implementation rely on cleaning up (parts of) the db beforehand, for example

indexEntryRepository.deleteAll();
indexSettingsRepository.deleteAll();

Cleaning up the db before each test is a valid strategy, see e.g. here, but the current implementation only cleans up specific repositories, instead of resetting the entire db.
As a result, it is easy to forget to clean one up, which may lead to nasty surprises later on, such as #839.

Note that an alternative would be to mark tests with @DataJpaTest or @Transactional, which would roll back any changes after the test. Also see #816

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreMaintenanceimprovementExisting functionality that can be improvedtestsRelated to tests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions