Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,22 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;

import java.io.IOException;
import java.time.Duration;

import static org.assertj.core.api.Assertions.assertThat;

@Testcontainers
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class TestAlluxioFileSystem
extends AbstractTestTrinoFileSystem
{
private static final String IMAGE_NAME = "alluxio/alluxio:2.9.5";
private static final DockerImageName ALLUXIO_IMAGE = DockerImageName.parse(IMAGE_NAME);

@Container
private static final GenericContainer<?> ALLUXIO_MASTER_CONTAINER = createAlluxioMasterContainer();

@Container
private static final GenericContainer<?> ALLUXIO_WORKER_CONTAINER = createAlluxioWorkerContainer();

private GenericContainer<?> alluxioMaster;
private GenericContainer<?> alluxioWorker;
private TrinoFileSystem fileSystem;
private Location rootLocation;
private FileSystem alluxioFs;
Expand All @@ -63,6 +56,8 @@ public class TestAlluxioFileSystem
@BeforeAll
void setup()
{
alluxioMaster = createAlluxioMasterContainer();
alluxioWorker = createAlluxioWorkerContainer();
this.rootLocation = Location.of("alluxio:///");
InstancedConfiguration conf = Configuration.copyGlobal();
FileSystemContext fsContext = FileSystemContext.create(conf);
Expand All @@ -77,6 +72,12 @@ void setup()
@AfterAll
void tearDown()
{
if (alluxioMaster != null) {
alluxioMaster.close();
}
if (alluxioWorker != null) {
alluxioWorker.close();
}
fileSystem = null;
alluxioFs = null;
rootLocation = null;
Expand Down Expand Up @@ -154,6 +155,7 @@ private static GenericContainer<?> createAlluxioMasterContainer()
.waitingFor(new LogMessageWaitStrategy()
.withRegEx(".*Primary started*\n")
.withStartupTimeout(Duration.ofMinutes(3)));
container.start();
return container;
}

Expand All @@ -172,8 +174,8 @@ private static GenericContainer<?> createAlluxioWorkerContainer()
+ "-Dalluxio.security.authorization.permission.enabled=false "
+ "-Dalluxio.security.authorization.plugins.enabled=false ")
.withAccessToHost(true)
.dependsOn(ALLUXIO_MASTER_CONTAINER)
.waitingFor(Wait.forLogMessage(".*Alluxio worker started.*\n", 1));
container.start();
return container;
}
}
Loading