3232import org .testcontainers .containers .GenericContainer ;
3333import org .testcontainers .containers .wait .strategy .LogMessageWaitStrategy ;
3434import org .testcontainers .containers .wait .strategy .Wait ;
35- import org .testcontainers .junit .jupiter .Container ;
36- import org .testcontainers .junit .jupiter .Testcontainers ;
3735import org .testcontainers .utility .DockerImageName ;
3836
3937import java .io .IOException ;
4038import java .time .Duration ;
4139
4240import static org .assertj .core .api .Assertions .assertThat ;
4341
44- @ Testcontainers
4542@ TestInstance (TestInstance .Lifecycle .PER_CLASS )
4643public class TestAlluxioFileSystem
4744 extends AbstractTestTrinoFileSystem
4845{
4946 private static final String IMAGE_NAME = "alluxio/alluxio:2.9.5" ;
5047 private static final DockerImageName ALLUXIO_IMAGE = DockerImageName .parse (IMAGE_NAME );
5148
52- @ Container
53- private static final GenericContainer <?> ALLUXIO_MASTER_CONTAINER = createAlluxioMasterContainer ();
54-
55- @ Container
56- private static final GenericContainer <?> ALLUXIO_WORKER_CONTAINER = createAlluxioWorkerContainer ();
57-
49+ private GenericContainer <?> alluxioMaster ;
50+ private GenericContainer <?> alluxioWorker ;
5851 private TrinoFileSystem fileSystem ;
5952 private Location rootLocation ;
6053 private FileSystem alluxioFs ;
@@ -63,6 +56,8 @@ public class TestAlluxioFileSystem
6356 @ BeforeAll
6457 void setup ()
6558 {
59+ alluxioMaster = createAlluxioMasterContainer ();
60+ alluxioWorker = createAlluxioWorkerContainer ();
6661 this .rootLocation = Location .of ("alluxio:///" );
6762 InstancedConfiguration conf = Configuration .copyGlobal ();
6863 FileSystemContext fsContext = FileSystemContext .create (conf );
@@ -77,6 +72,12 @@ void setup()
7772 @ AfterAll
7873 void tearDown ()
7974 {
75+ if (alluxioMaster != null ) {
76+ alluxioMaster .close ();
77+ }
78+ if (alluxioWorker != null ) {
79+ alluxioWorker .close ();
80+ }
8081 fileSystem = null ;
8182 alluxioFs = null ;
8283 rootLocation = null ;
@@ -154,6 +155,7 @@ private static GenericContainer<?> createAlluxioMasterContainer()
154155 .waitingFor (new LogMessageWaitStrategy ()
155156 .withRegEx (".*Primary started*\n " )
156157 .withStartupTimeout (Duration .ofMinutes (3 )));
158+ container .start ();
157159 return container ;
158160 }
159161
@@ -172,8 +174,8 @@ private static GenericContainer<?> createAlluxioWorkerContainer()
172174 + "-Dalluxio.security.authorization.permission.enabled=false "
173175 + "-Dalluxio.security.authorization.plugins.enabled=false " )
174176 .withAccessToHost (true )
175- .dependsOn (ALLUXIO_MASTER_CONTAINER )
176177 .waitingFor (Wait .forLogMessage (".*Alluxio worker started.*\n " , 1 ));
178+ container .start ();
177179 return container ;
178180 }
179181}
0 commit comments