mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 22:16:22 +00:00
Add smoke test for SQL migrations and Paper startup (#654)
In the future we may want to use a matrix and test other platforms related: #652, #653
This commit is contained in:
1 parent
d516736d21
commit
b820439d46
4 files changed
+117
-2
No files matched your search
@@ -66,6 +66,23 @@ tasks {
|
||||
github("MiniPlaceholders", "PlaceholderAPI-Expansion", "1.2.0", "PlaceholderAPI-Expansion-1.2.0.jar")
|
||||
hangar("PlaceholderAPI", libs.versions.placeholderapi.get())
|
||||
}
|
||||
providers.gradleProperty("smokeTest").map { it.toBoolean() }.getOrElse(false).let { smokeTest ->
|
||||
if (smokeTest) {
|
||||
runDirectory.set(layout.buildDirectory.dir("tmp/smokeTest"))
|
||||
doFirst {
|
||||
runDirectory.get().file("carbonchat-smoketest").asFile.takeIf { it.exists() }?.delete()
|
||||
runDirectory.get().file("eula.txt").asFile.also { it.parentFile.mkdirs() }.writeText("eula=true")
|
||||
}
|
||||
doLast {
|
||||
val pass = runDirectory.get().file("carbonchat-smoketest").asFile.exists()
|
||||
if (!pass) {
|
||||
throw GradleException("Smoke test failed, please check the logs.")
|
||||
}
|
||||
}
|
||||
systemProperty("carbonchat.smokeTest", true)
|
||||
systemProperty("carbonchat.smokeTestMode", providers.gradleProperty("smokeTestMode").getOrElse("h2"))
|
||||
}
|
||||
}
|
||||
}
|
||||
register<RunServer>("runServer2") {
|
||||
pluginJars.from(shadowJar.flatMap { it.archiveFile })
|
||||
|
||||
@@ -25,6 +25,8 @@ import com.google.inject.Key;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
import com.google.inject.TypeLiteral;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import net.draycia.carbon.api.CarbonServer;
|
||||
@@ -116,6 +118,19 @@ public final class CarbonChatPaper extends CarbonChatInternal {
|
||||
}));
|
||||
|
||||
this.checkVersion();
|
||||
|
||||
if (Boolean.getBoolean("carbonchat.smokeTest")) {
|
||||
this.logger().info("Smoke test: CarbonChat successfully enabled.");
|
||||
try {
|
||||
new File("carbonchat-smoketest").createNewFile();
|
||||
} catch (final IOException e) {
|
||||
this.logger().error("Smoke test: Failed to create file.", e);
|
||||
}
|
||||
this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () -> {
|
||||
this.logger().info("Smoke test: Shutting down server.");
|
||||
Bukkit.getServer().shutdown();
|
||||
}, 20L);
|
||||
}
|
||||
}
|
||||
|
||||
private void registerPlaceholders() {
|
||||
|
||||
Reference in new issue
Block a user