mirror of
https://github.com/lucko/LuckPerms.git
synced 2025-09-01 18:32:33 +02:00
Add REST storage backend (#3939)
This commit is contained in:
@@ -48,6 +48,7 @@ dependencies {
|
||||
testImplementation 'me.lucko.configurate:configurate-toml:3.7'
|
||||
testImplementation 'org.spongepowered:configurate-hocon:3.7.2'
|
||||
testImplementation 'org.yaml:snakeyaml:1.28'
|
||||
testImplementation 'net.luckperms:rest-api-java-client:0.1-SNAPSHOT'
|
||||
|
||||
testImplementation project(':standalone:app')
|
||||
testImplementation project(':common:loader-utils')
|
||||
|
@@ -58,7 +58,11 @@ import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
import org.testcontainers.containers.output.Slf4jLogConsumer;
|
||||
import org.testcontainers.containers.wait.strategy.Wait;
|
||||
import org.testcontainers.containers.wait.strategy.WaitAllStrategy;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
@@ -364,6 +368,35 @@ public class StorageIntegrationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@Tag("docker")
|
||||
class Rest {
|
||||
|
||||
@Container
|
||||
private final GenericContainer<?> container = new GenericContainer<>(DockerImageName.parse("ghcr.io/luckperms/rest-api"))
|
||||
.withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(StorageIntegrationTest.class)))
|
||||
.withExposedPorts(8080)
|
||||
.waitingFor(new WaitAllStrategy()
|
||||
.withStrategy(Wait.forListeningPort())
|
||||
.withStrategy(Wait.forLogMessage(".*Successfully enabled.*", 1))
|
||||
);
|
||||
|
||||
@Test
|
||||
public void testRest(@TempDir Path tempDir) {
|
||||
assertTrue(this.container.isRunning());
|
||||
|
||||
String host = this.container.getHost();
|
||||
Integer port = this.container.getFirstMappedPort();
|
||||
|
||||
Map<String, String> config = ImmutableMap.<String, String>builder()
|
||||
.put("storage-method", "rest")
|
||||
.put("data.rest-url", "http://" + host + ":" + port + "/")
|
||||
.build();
|
||||
|
||||
TestPluginProvider.use(tempDir, config, StorageIntegrationTest::testStorage);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
class FlatFileDatabase {
|
||||
|
||||
|
Reference in New Issue
Block a user