Skip to content

Commit

Permalink
Review test container setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Jan 22, 2025
1 parent 0c400c0 commit d76fe17
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import ch.cyberduck.test.TestcontainerTest;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.experimental.categories.Category;
import org.testcontainers.containers.ComposeContainer;
import org.testcontainers.containers.wait.strategy.Wait;
Expand All @@ -27,17 +27,23 @@

@Category(TestcontainerTest.class)
public abstract class AbstractAssumeRoleWithWebIdentityTest {
protected static final Logger log = LogManager.getLogger(AbstractAssumeRoleWithWebIdentityTest.class);

protected static final int OAUTH_TTL_MILLIS = 5000;

public static ComposeContainer prepareDockerComposeContainer() {
log.info("Preparing docker compose container...");
return new ComposeContainer(
new File(AbstractAssumeRoleWithWebIdentityTest.class.getResource("/testcontainer/docker-compose.yml").getFile()))
.withPull(false)
.withLocalCompose(true)
.withExposedService("keycloak-1", 8080, Wait.forListeningPort())
.withExposedService("minio-1", 9000, Wait.forListeningPort());
private static final ComposeContainer container = new ComposeContainer(
new File(AbstractAssumeRoleWithWebIdentityTest.class.getResource("/testcontainer/docker-compose.yml").getFile()))
.withPull(false)
.withLocalCompose(true)
.withExposedService("keycloak-1", 8080, Wait.forListeningPort())
.withExposedService("minio-1", 9000, Wait.forListeningPort());

@BeforeClass
public static void start() {
container.start();
}

@AfterClass
public static void shutdown() {
container.stop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@
import ch.cyberduck.test.TestcontainerTest;

import org.jets3t.service.security.AWSSessionCredentials;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.testcontainers.containers.ComposeContainer;
import org.testcontainers.shaded.org.apache.commons.lang3.StringUtils;

import java.util.Collections;
Expand All @@ -54,9 +52,6 @@
@Category(TestcontainerTest.class)
public class AssumeRoleWithWebIdentityAuthenticationTest extends AbstractAssumeRoleWithWebIdentityTest {

@ClassRule
public static ComposeContainer compose = prepareDockerComposeContainer();

@Test
public void testSuccessfulLogin() throws BackgroundException {
final Protocol profile = new ProfilePlistReader(new ProtocolFactory(new HashSet<>(Collections.singleton(new S3Protocol())))).read(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@
import ch.cyberduck.core.transfer.TransferStatus;
import ch.cyberduck.test.TestcontainerTest;

import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.testcontainers.containers.ComposeContainer;

import java.util.Collections;
import java.util.EnumSet;
Expand All @@ -54,9 +52,6 @@
@Category(TestcontainerTest.class)
public class AssumeRoleWithWebIdentityAuthorizationTest extends AbstractAssumeRoleWithWebIdentityTest {

@ClassRule
public static ComposeContainer compose = prepareDockerComposeContainer();

@Test
public void testAuthorizationFindBucket() throws BackgroundException {
final Protocol profile = new ProfilePlistReader(new ProtocolFactory(new HashSet<>(Collections.singleton(new S3Protocol())))).read(
Expand Down

0 comments on commit d76fe17

Please sign in to comment.