Skip to content

Commit

Permalink
Merge pull request #15001 from iterate-ch/feature/GH-13804-oidc-fix-s…
Browse files Browse the repository at this point in the history
…ts-containertests

Bugfix STS testcontainer tests (BeforeClass annotation in abstract te…
  • Loading branch information
dkocher authored Aug 16, 2023
2 parents 1fd9967 + 35d892d commit 1ce1d72
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.exception.AccessDeniedException;
import ch.cyberduck.core.exception.BackgroundException;
import ch.cyberduck.core.s3.S3Protocol;
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
import ch.cyberduck.test.TestcontainerTest;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.experimental.categories.Category;
import org.testcontainers.containers.DockerComposeContainer;
import org.testcontainers.containers.wait.strategy.Wait;
Expand Down Expand Up @@ -56,13 +53,7 @@ public abstract class AbstractAssumeRoleWithWebIdentityTest {

protected static Profile profile = null;

@ClassRule
public static DockerComposeContainer<?> compose = prepareDockerComposeContainer(getKeyCloakFile());

@Before
public void setup() throws BackgroundException {
profile = readProfile();
}

public static DockerComposeContainer prepareDockerComposeContainer(final String keyCloakRealmTempFile) {
log.info("Preparing docker compose container...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,24 @@
import ch.cyberduck.core.HostUrlProvider;
import ch.cyberduck.core.OAuthTokens;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.Profile;
import ch.cyberduck.core.ProtocolFactory;
import ch.cyberduck.core.STSTokens;
import ch.cyberduck.core.exception.BackgroundException;
import ch.cyberduck.core.exception.ExpiredTokenException;
import ch.cyberduck.core.exception.InteroperabilityException;
import ch.cyberduck.core.exception.LoginFailureException;
import ch.cyberduck.core.proxy.DisabledProxyFinder;
import ch.cyberduck.core.s3.S3AccessControlListFeature;
import ch.cyberduck.core.s3.S3BucketListService;
import ch.cyberduck.core.s3.S3FindFeature;
import ch.cyberduck.core.s3.S3Protocol;
import ch.cyberduck.core.s3.S3Session;
import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader;
import ch.cyberduck.test.TestcontainerTest;

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

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

@ClassRule
public static DockerComposeContainer<?> compose = prepareDockerComposeContainer(getKeyCloakFile());

@Before
public void setup() throws BackgroundException {
profile = readProfile();
}

@Test
public void testSuccessfulLogin() throws BackgroundException {
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials("rouser", "rouser"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@
import ch.cyberduck.core.transfer.TransferStatus;
import ch.cyberduck.test.TestcontainerTest;

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

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

@ClassRule
public static DockerComposeContainer<?> compose = prepareDockerComposeContainer(getKeyCloakFile());

@Before
public void setup() throws BackgroundException {
profile = readProfile();
}


@Test
public void testAuthorizationFindBucket() throws BackgroundException {
final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials("rawuser", "rawuser"));
Expand Down

0 comments on commit 1ce1d72

Please sign in to comment.