Skip to content

Commit

Permalink
Update IT pass-core container config
Browse files Browse the repository at this point in the history
  • Loading branch information
rpoet-jh committed Oct 28, 2024
1 parent 50c257e commit 1bb50c9
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 32 deletions.
17 changes: 0 additions & 17 deletions pass-data-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<properties>
<!-- Properties for dependency versions -->
<spring-boot-maven-plugin.version>3.2.1</spring-boot-maven-plugin.version>
<okhttp.version>4.12.0</okhttp.version>
<moshi.version>4.12.0</moshi.version>
<jsonapi-adapters.version>1.1.0</jsonapi-adapters.version>
Expand Down Expand Up @@ -78,13 +77,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring-boot-maven-plugin.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down Expand Up @@ -113,13 +105,6 @@
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<pass.core.url>${pass.core.url}</pass.core.url>
<pass.core.user>${pass.core.user}</pass.core.user>
<pass.core.password>${pass.core.password}</pass.core.password>
</systemPropertyVariables>
</configuration>
</plugin>

<plugin>
Expand Down Expand Up @@ -167,14 +152,12 @@
<!-- These come from testcontainers junit-jupiter -->
<ignoredUsedUndeclaredDependency>org.testcontainers::</ignoredUsedUndeclaredDependency>
<ignoredUsedUndeclaredDependency>com.github.docker-java::</ignoredUsedUndeclaredDependency>
<ignoredUsedUndeclaredDependency>org.springframework:spring-test</ignoredUsedUndeclaredDependency>
</ignoredUsedUndeclaredDependencies>
<ignoredUnusedDeclaredDependencies>
<!-- slf4j is the API used in the code, logback is the logging provider not used directly -->
<ignoredUnusedDeclaredDependency>ch.qos.logback:logback-classic</ignoredUnusedDeclaredDependency>
<!-- junit-jupiter is a module containing the junit api jars used directly -->
<ignoredUnusedDeclaredDependency>org.junit.jupiter:junit-jupiter</ignoredUnusedDeclaredDependency>
<ignoredUnusedDeclaredDependency>org.springframework.boot:spring-boot-starter-test</ignoredUnusedDeclaredDependency>
</ignoredUnusedDeclaredDependencies>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2024 Johns Hopkins University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.eclipse.pass.support.client;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
Expand Down Expand Up @@ -27,6 +42,8 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import com.github.dockerjava.api.model.ExposedPort;
import com.github.dockerjava.api.model.PortBinding;
import com.github.dockerjava.api.model.Ports;
Expand Down Expand Up @@ -59,15 +76,15 @@
import org.eclipse.pass.support.client.model.UserRole;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.test.annotation.DirtiesContext;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;
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 org.testcontainers.utility.MountableFile;

@Testcontainers
@DirtiesContext
public class JsonApiPassClientIT {
private static final DockerImageName PASS_CORE_IMG;

Expand All @@ -83,11 +100,19 @@ public class JsonApiPassClientIT {

System.setProperty("pass.core.url", "http://localhost:8080");
System.setProperty("pass.core.user", "backend");
System.setProperty("pass.core.password", "moo");
System.setProperty("pass.core.password", "backend");

Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.WARN);
}

@Container
private static final GenericContainer<?> PASS_CORE_CONTAINER = new GenericContainer<>(PASS_CORE_IMG)
.withCopyFileToContainer(
MountableFile.forHostPath("../pass-core-test-config/"),
"/tmp/pass-core-test-config/"
)
.withEnv("PASS_CORE_JAVA_OPTS", "-Dspring.config.import=file:/tmp/pass-core-test-config/application-test.yml")
.withCreateContainerCmdModifier(cmd -> {
cmd.getHostConfig().withPortBindings(new PortBinding(Ports.Binding.bindPort(8080),
new ExposedPort(8080)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.utility.MountableFile;

/**
* Provides convenience methods for depositing Submissions in PASS.
Expand Down Expand Up @@ -93,9 +94,11 @@ public abstract class AbstractDepositSubmissionIT {

@Container
protected static final GenericContainer<?> PASS_CORE_CONTAINER = new GenericContainer<>(PASS_CORE_IMG)
.withEnv("PASS_CORE_BASE_URL", "http://localhost:8080")
.withEnv("PASS_CORE_USER", "backend")
.withEnv("PASS_CORE_PASSWORD", "backend")
.withCopyFileToContainer(
MountableFile.forHostPath("../../pass-core-test-config/"),
"/tmp/pass-core-test-config/"
)
.withEnv("PASS_CORE_JAVA_OPTS", "-Dspring.config.import=file:/tmp/pass-core-test-config/application-test.yml")
.waitingFor(Wait.forHttp("/data/grant").forStatusCode(200).withBasicCredentials("backend", "backend"))
.withExposedPorts(8080);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.utility.MountableFile;

/**
* @author Russ Poetker ([email protected])
Expand All @@ -59,9 +60,11 @@ public abstract class AbstractIntegrationTest {

@Container
protected static final GenericContainer<?> PASS_CORE_CONTAINER = new GenericContainer<>(PASS_CORE_IMG)
.withEnv("PASS_CORE_BASE_URL", "http://localhost:8080")
.withEnv("PASS_CORE_USER", "backend")
.withEnv("PASS_CORE_PASSWORD", "backend")
.withCopyFileToContainer(
MountableFile.forHostPath("../pass-core-test-config/"),
"/tmp/pass-core-test-config/"
)
.withEnv("PASS_CORE_JAVA_OPTS", "-Dspring.config.import=file:/tmp/pass-core-test-config/application-test.yml")
.waitingFor(Wait.forHttp("/data/grant").forStatusCode(200).withBasicCredentials("backend", "backend"))
.withExposedPorts(8080);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.utility.MountableFile;

/**
* @author Karen Hanson
Expand Down Expand Up @@ -92,9 +93,11 @@ public abstract class NihmsSubmissionEtlITBase {

@Container
protected static final GenericContainer<?> PASS_CORE_CONTAINER = new GenericContainer<>(PASS_CORE_IMG)
.withEnv("PASS_CORE_BASE_URL", "http://localhost:8080")
.withEnv("PASS_CORE_USER", "backend")
.withEnv("PASS_CORE_PASSWORD", "backend")
.withCopyFileToContainer(
MountableFile.forHostPath("../../pass-core-test-config/"),
"/tmp/pass-core-test-config/"
)
.withEnv("PASS_CORE_JAVA_OPTS", "-Dspring.config.import=file:/tmp/pass-core-test-config/application-test.yml")
.waitingFor(Wait.forHttp("/data/grant").forStatusCode(200).withBasicCredentials("backend", "backend"))
.withExposedPorts(8080);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.utility.MountableFile;

/**
* @author Russ Poetker ([email protected])
Expand Down Expand Up @@ -88,9 +89,11 @@ public class NotificationServiceIT extends AbstractNotificationSpringIntegration

@Container
static final GenericContainer<?> PASS_CORE_CONTAINER = new GenericContainer<>(PASS_CORE_IMG)
.withEnv("PASS_CORE_BASE_URL", "http://localhost:8080")
.withEnv("PASS_CORE_USER", "backend")
.withEnv("PASS_CORE_PASSWORD", "backend")
.withCopyFileToContainer(
MountableFile.forHostPath("../pass-core-test-config/"),
"/tmp/pass-core-test-config/"
)
.withEnv("PASS_CORE_JAVA_OPTS", "-Dspring.config.import=file:/tmp/pass-core-test-config/application-test.yml")
.waitingFor(Wait.forHttp("/data/grant").forStatusCode(200).withBasicCredentials("backend", "backend"))
.withExposedPorts(8080);

Expand Down

0 comments on commit 1bb50c9

Please sign in to comment.