-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
choreMaintenanceMaintenanceimprovementExisting functionality that can be improvedExisting functionality that can be improvedtestsRelated to testsRelated to tests
Description
Many tests in the current implementation rely on cleaning up (parts of) the db beforehand, for example
FAIRDataPoint/src/test/java/org/fairdatapoint/acceptance/index/admin/List_Trigger_POST.java
Lines 159 to 160 in f65cd35
| 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
choreMaintenanceMaintenanceimprovementExisting functionality that can be improvedExisting functionality that can be improvedtestsRelated to testsRelated to tests