mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
faster integration tests execution by truncating tables instead of dropping and recreating tables
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
package com.commafeed;
|
||||
|
||||
import jakarta.enterprise.inject.spi.CDI;
|
||||
import jakarta.persistence.EntityManager;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.kohsuke.MetaInfServices;
|
||||
|
||||
import com.commafeed.backend.service.db.DatabaseStartupService;
|
||||
|
||||
import io.quarkus.liquibase.runtime.LiquibaseSchemaProvider;
|
||||
import io.quarkus.test.junit.callback.QuarkusTestBeforeEachCallback;
|
||||
import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
|
||||
|
||||
@@ -18,7 +19,14 @@ public class DatabaseReset implements QuarkusTestBeforeEachCallback {
|
||||
|
||||
@Override
|
||||
public void beforeEach(QuarkusTestMethodContext context) {
|
||||
new LiquibaseSchemaProvider().resetAllDatabases();
|
||||
CDI.current()
|
||||
.select(EntityManager.class)
|
||||
.get()
|
||||
.unwrap(Session.class)
|
||||
.getSessionFactory()
|
||||
.getSchemaManager()
|
||||
.truncateMappedObjects();
|
||||
|
||||
CDI.current().select(DatabaseStartupService.class).get().populateInitialData();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user