Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ coverage:
precision: 1
round: up
range: "70...100"
status:
project:
default:
target: auto
threshold: 1%
parsers:
jacoco:
partials_as_hits: true
partials_as_hits: true
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.redis.testcontainers.RedisContainer;
import org.flywaydb.core.Flyway;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Import;
Expand Down Expand Up @@ -38,6 +39,7 @@ static void beforeAll() throws SQLException, IOException {
postgresSQLContainer.getUsername(),
postgresSQLContainer.getPassword()
).load();
flyway.migrate();
logContainerInfo();
}

Expand Down Expand Up @@ -120,6 +122,11 @@ protected void clearAllData() throws SQLException, IOException {
executeSQLFile(CLEANUP_SQL);
}

@BeforeEach
void resetDatabaseState() throws SQLException, IOException {
clearAllData();
}


protected static void populateDummyData() throws SQLException, IOException {
executeSQLFile(DATA_SQL);
Expand Down
11 changes: 8 additions & 3 deletions src/test/resources/cleanup.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
DELETE FROM participant;
DELETE FROM event;
DELETE FROM guild;
TRUNCATE TABLE participant, event, guild, embed_type, user_role, users, role RESTART IDENTITY CASCADE;

INSERT INTO embed_type (name, structure)
VALUES ('default', '{"-1":"Absence","-2":"Late","1":"Tank","-3":"Tentative","2":"Melee","3":"Ranged","4":"Healer","5":"Support"}');

INSERT INTO role(name) VALUES('USER');
INSERT INTO role(name) VALUES('MODERATOR');
INSERT INTO role(name) VALUES('ADMIN');
Loading