Setup logs into tempfs too for volatile storage

This commit is contained in:
games647
2022-02-11 16:00:38 +01:00
parent f355bf7ff2
commit 9a9a75fbb5

View File

@ -44,6 +44,8 @@ public class LoginIT {
private static final String API_IMAGE_NAME = "mockserver/mockserver";
private static final String API_IMAGE = API_IMAGE_NAME + ':' + API_TAG;
private static final String HOME_FOLDER = "/home/nonroot/";
@Rule
public MockServerContainer mockServer = new MockServerContainer(DockerImageName.parse(API_IMAGE))
.withReuse(true);
@ -57,16 +59,24 @@ public class LoginIT {
.withEnv("JDK_JAVA_OPTIONS", buildJVMFlags())
.withExposedPorts(25565)
// use server settings that use minimal minecraft log to quickly ramp up the server
.withCopyFileToContainer(MountableFile.forClasspathResource("server.properties"), "/home/nonroot/server.properties")
.withCopyFileToContainer(MountableFile.forClasspathResource("bukkit.yml"), "/home/nonroot/bukkit.yml")
.withCopyFileToContainer(MountableFile.forClasspathResource("spigot.yml"), "/home/nonroot/spigot.yml")
.withTmpFs(Collections.singletonMap("/home/nonroot/world", "rw,noexec,nosuid,nodev"))
.withCopyFileToContainer(MountableFile.forClasspathResource("server.properties"), HOME_FOLDER + "server.properties")
.withCopyFileToContainer(MountableFile.forClasspathResource("bukkit.yml"), HOME_FOLDER + "bukkit.yml")
.withCopyFileToContainer(MountableFile.forClasspathResource("spigot.yml"), HOME_FOLDER + "spigot.yml")
// create folders that are volatile
.withTmpFs(getTempFS())
// Done (XXXXs)! For help, type "help"
.waitingFor(
Wait.forLogMessage(".*For help, type \"help\"*\\n", 1)
)
.withReuse(true);
private Map<String, String> getTempFS() {
Map<String, String> tmpfs = new HashMap<>();
tmpfs.put(HOME_FOLDER + "world", "rw,noexec,nosuid,nodev");
tmpfs.put(HOME_FOLDER + "logs", "rw,noexec,nosuid,nodev");
return tmpfs;
}
private String buildJVMFlags() {
Map<String, String> systemProperties = new HashMap<>();
systemProperties.put("com.mojang.eula.agree", Boolean.toString(true));