mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-23 09:37:54 +01:00
Additional assertions to patch regression tests
- Check that the patches have been properly applied - Check that removal works
This commit is contained in:
parent
f333ae7cc9
commit
f8391305dc
@ -1,7 +1,10 @@
|
||||
package com.djrapitops.plan.system.database.databases.sql;
|
||||
|
||||
import com.djrapitops.plan.system.database.databases.sql.patches.Patch;
|
||||
import utilities.TestConstants;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public abstract class PatchRegression452Test {
|
||||
|
||||
String insertServer = "INSERT INTO plan_servers (uuid) VALUES ('" + TestConstants.SERVER_UUID + "')";
|
||||
@ -28,4 +31,10 @@ public abstract class PatchRegression452Test {
|
||||
underTest.execute(insertWorld);
|
||||
underTest.execute(insertWorldTimes);
|
||||
}
|
||||
|
||||
protected void assertPatchesHaveBeenApplied(SQLDB underTest) {
|
||||
for (Patch patch : underTest.patches()) {
|
||||
assertTrue("Patch " + patch.getClass().getSimpleName() + " was not applied properly.", patch.hasBeenApplied());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,8 +100,13 @@ public class PatchRegressionH2452Test extends PatchRegression452Test {
|
||||
// Patching might fail due to exception.
|
||||
patchTask.run();
|
||||
|
||||
assertPatchesHaveBeenApplied(underTest);
|
||||
|
||||
// Make sure that a fetch works.
|
||||
ServerContainer server = underTest.fetch().getServerContainer(TestConstants.SERVER_UUID);
|
||||
OptionalAssert.equals(1, server.getValue(ServerKeys.PLAYER_KILL_COUNT));
|
||||
|
||||
// Make sure no foreign key checks fail on removal
|
||||
underTest.remove().everything();
|
||||
}
|
||||
}
|
||||
|
@ -124,8 +124,13 @@ public class PatchRegressionMySQL452Test extends PatchRegression452Test {
|
||||
// Patching might fail due to exception.
|
||||
patchTask.run();
|
||||
|
||||
assertPatchesHaveBeenApplied(underTest);
|
||||
|
||||
// Make sure that a fetch works.
|
||||
ServerContainer server = underTest.fetch().getServerContainer(TestConstants.SERVER_UUID);
|
||||
OptionalAssert.equals(1, server.getValue(ServerKeys.PLAYER_KILL_COUNT));
|
||||
|
||||
// Make sure no foreign key checks fail on removal
|
||||
underTest.remove().everything();
|
||||
}
|
||||
}
|
||||
|
@ -93,8 +93,13 @@ public class PatchRegressionSQLite452Test extends PatchRegression452Test {
|
||||
// Patching might fail due to exception.
|
||||
patchTask.run();
|
||||
|
||||
assertPatchesHaveBeenApplied(underTest);
|
||||
|
||||
// Make sure that a fetch works.
|
||||
ServerContainer server = underTest.fetch().getServerContainer(TestConstants.SERVER_UUID);
|
||||
OptionalAssert.equals(1, server.getValue(ServerKeys.PLAYER_KILL_COUNT));
|
||||
|
||||
// Make sure no foreign key checks fail on removal
|
||||
underTest.remove().everything();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user