Skip to content

Commit

Permalink
Add Saml test connection timeout debugging output (elastic#104801)
Browse files Browse the repository at this point in the history
Add additional logging to idp test fixture container
  • Loading branch information
breskeby authored Mar 6, 2024
1 parent 78df37c commit 46beceb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void setupNativeUser() throws IOException {
* <li>Uses that token to verify the user details</li>
* </ol>
*/
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/103595")
// @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/103595")
public void testLoginUserWithSamlRoleMapping() throws Exception {
final Tuple<String, String> authTokens = loginViaSaml("shibboleth");
verifyElasticsearchAccessTokenForRoleMapping(authTokens.v1());
Expand All @@ -262,7 +262,7 @@ public void testLoginUserWithSamlRoleMapping() throws Exception {
verifyElasticsearchAccessTokenInvalidated(accessToken);
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/103595")
// @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/103595")
public void testLoginUserWithAuthorizingRealm() throws Exception {
final Tuple<String, String> authTokens = loginViaSaml("shibboleth_native");
verifyElasticsearchAccessTokenForAuthorizingRealms(authTokens.v1());
Expand All @@ -273,7 +273,7 @@ public void testLoginUserWithAuthorizingRealm() throws Exception {
verifyElasticsearchAccessTokenInvalidated(accessToken);
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/103595")
// @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/103595")
public void testLoginWithWrongRealmFails() throws Exception {
final BasicHttpContext context = new BasicHttpContext();
try (CloseableHttpClient client = getHttpClient()) {
Expand Down
15 changes: 7 additions & 8 deletions x-pack/test/idp-fixture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@ dependencies {
api "junit:junit:${versions.junit}"
}

tasks.withType(DockerBuildTask).configureEach {
noCache = BuildParams.isCi()
push = true //BuildParams.isCi()
getPlatforms().addAll( Architecture.values().collect{ it.dockerPlatform } )
}

tasks.register("deployIdpFixtureDockerImages", DockerBuildTask) {
dockerContext.fileValue(file("src/main/resources/idp"))
baseImages = ["openjdk:11.0.16-jre"]
noCache = BuildParams.isCi()
tags = ["docker.elastic.co/elasticsearch-dev/idp-fixture:1.0"]
push = BuildParams.isCi()
getPlatforms().addAll( Architecture.values().collect{ it.dockerPlatform } )
tags = ["docker.elastic.co/elasticsearch-dev/idp-fixture:1.1"]
}


tasks.register("deployOpenLdapFixtureDockerImages", DockerBuildTask) {
dockerContext.fileValue(file("src/main/resources/openldap"))
baseImages = ["osixia/openldap:1.4.0"]
noCache = BuildParams.isCi()
tags = ["docker.elastic.co/elasticsearch-dev/openldap-fixture:1.0"]
push = BuildParams.isCi()
getPlatforms().addAll( Architecture.values().collect{ it.dockerPlatform } )
}

tasks.register("deployFixtureDockerImages") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

public final class IdpTestContainer extends DockerEnvironmentAwareTestContainer {

private static final String DOCKER_BASE_IMAGE = "docker.elastic.co/elasticsearch-dev/idp-fixture:1.0";
private static final String DOCKER_BASE_IMAGE = "docker.elastic.co/elasticsearch-dev/idp-fixture:1.1";
private final TemporaryFolder temporaryFolder = new TemporaryFolder();
private Path certsPath;

Expand Down
12 changes: 8 additions & 4 deletions x-pack/test/idp-fixture/src/main/resources/idp/bin/run-jetty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ sed -i "s/^-Xmx.*$/-Xmx$JETTY_MAX_HEAP/g" /opt/shib-jetty-base/start.ini

# For some reason, this container always immediately (in less than 1 second) exits with code 0 when starting for the first time
# Even with a health check, docker-compose will immediately report the container as unhealthy when using --wait instead of waiting for it to become healthy
# So, let's just start it a second time if it exits quickly
# So, let's just start it a second time
set +e
start_time=$(date +%s)
/opt/jetty-home/bin/jetty.sh run
exit_code=$?
end_time=$(date +%s)

duration=$((end_time - start_time))
if [ $duration -lt 10 ]; then
/opt/jetty-home/bin/jetty.sh run
exit_code=$?
echo "Duration for initial idp run was $duration seconds."

if [ $duration -lt 60 ]; then
echo "Restarting idp."

/opt/jetty-home/bin/jetty.sh run
exit_code=$?
fi

exit $exit_code

0 comments on commit 46beceb

Please sign in to comment.