-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#22706 Testing testcontainers on cloud using GHA.
- Loading branch information
Showing
2 changed files
with
41 additions
and
41 deletions.
There are no files selected for viewing
78 changes: 39 additions & 39 deletions
78
tools/dotcms-cli/api-data-model/src/test/java/com/dotcms/ContainerResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
//package com.dotcms; | ||
// | ||
//import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; | ||
//import org.testcontainers.containers.DockerComposeContainer; | ||
//import org.testcontainers.containers.wait.strategy.Wait; | ||
// | ||
//import java.io.File; | ||
//import java.time.Duration; | ||
//import java.util.HashMap; | ||
//import java.util.Map; | ||
// | ||
//public class ContainerResource implements QuarkusTestResourceLifecycleManager { | ||
// | ||
// private static final int POSTGRES_SERVICE_PORT = 5432; | ||
// private static final int ELASTICSEARCH_SERVICE_PORT = 9200; | ||
// private static final int DOTCMS_SERVICE_PORT = 8080; | ||
// private static final int STARTUP_TIMEOUT = 120; | ||
// private static final boolean LOCAL_COMPOSE = false; | ||
// | ||
// static DockerComposeContainer<?> COMPOSE_CONTAINER = | ||
// new DockerComposeContainer("dotcms-env", new File("src/test/resources/docker-compose.yaml")) | ||
// .withExposedService("postgres", POSTGRES_SERVICE_PORT, Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(STARTUP_TIMEOUT))) | ||
// .withExposedService("elasticsearch", ELASTICSEARCH_SERVICE_PORT, Wait.forHttp("/").forPort(ELASTICSEARCH_SERVICE_PORT).forStatusCode(200)) | ||
// .withExposedService("dotcms", DOTCMS_SERVICE_PORT, Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(STARTUP_TIMEOUT))) | ||
// .withLocalCompose(LOCAL_COMPOSE); // need to be false to run on macOS | ||
// @Override | ||
// public Map<String, String> start() { | ||
// COMPOSE_CONTAINER.start(); | ||
// final Map<String, String> conf = new HashMap<>(); | ||
// conf.put("%test.dotcms.url", COMPOSE_CONTAINER.getServiceHost("dotcms", DOTCMS_SERVICE_PORT) + ":" + COMPOSE_CONTAINER.getServicePort("dotcms", DOTCMS_SERVICE_PORT)); | ||
// | ||
// return conf; | ||
// } | ||
// | ||
// @Override | ||
// public void stop() { | ||
// COMPOSE_CONTAINER.stop(); | ||
// } | ||
//} | ||
package com.dotcms; | ||
|
||
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; | ||
import org.testcontainers.containers.DockerComposeContainer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
|
||
import java.io.File; | ||
import java.time.Duration; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class ContainerResource implements QuarkusTestResourceLifecycleManager { | ||
|
||
private static final int POSTGRES_SERVICE_PORT = 5432; | ||
private static final int ELASTICSEARCH_SERVICE_PORT = 9200; | ||
private static final int DOTCMS_SERVICE_PORT = 8080; | ||
private static final int STARTUP_TIMEOUT = 120; | ||
private static final boolean LOCAL_COMPOSE = false; | ||
|
||
static DockerComposeContainer<?> COMPOSE_CONTAINER = | ||
new DockerComposeContainer("dotcms-env", new File("src/test/resources/docker-compose.yaml")) | ||
.withExposedService("postgres", POSTGRES_SERVICE_PORT, Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(STARTUP_TIMEOUT))) | ||
.withExposedService("elasticsearch", ELASTICSEARCH_SERVICE_PORT, Wait.forHttp("/").forPort(ELASTICSEARCH_SERVICE_PORT).forStatusCode(200)) | ||
.withExposedService("dotcms", DOTCMS_SERVICE_PORT, Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(STARTUP_TIMEOUT))) | ||
.withLocalCompose(LOCAL_COMPOSE); // need to be false to run on macOS | ||
@Override | ||
public Map<String, String> start() { | ||
COMPOSE_CONTAINER.start(); | ||
final Map<String, String> conf = new HashMap<>(); | ||
conf.put("%test.dotcms.url", COMPOSE_CONTAINER.getServiceHost("dotcms", DOTCMS_SERVICE_PORT) + ":" + COMPOSE_CONTAINER.getServicePort("dotcms", DOTCMS_SERVICE_PORT)); | ||
|
||
return conf; | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
COMPOSE_CONTAINER.stop(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters