mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2740 - Bump ebean-test-containers to 6.2
This commit is contained in:
@@ -2,6 +2,7 @@ package io.ebean.test.config.platform;
|
||||
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.datasource.DataSourceConfig;
|
||||
import io.ebean.test.containers.DockerHost;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -38,7 +39,6 @@ class Config {
|
||||
private final DatabaseConfig config;
|
||||
private boolean containerDropCreate;
|
||||
private final Properties dockerProperties = new Properties();
|
||||
private final DockerHost dockerHost = new DockerHost();
|
||||
|
||||
Config(String db, String platform, String databaseName, DatabaseConfig config) {
|
||||
this.db = db;
|
||||
@@ -241,8 +241,7 @@ class Config {
|
||||
}
|
||||
|
||||
String host() {
|
||||
String explicitDockerHost = getKey("dockerHost", null);
|
||||
return getKey("host", dockerHost.dockerHost(explicitDockerHost));
|
||||
return getKey("host", getKey("dockerHost", DockerHost.host()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -385,10 +384,6 @@ class Config {
|
||||
}
|
||||
|
||||
private void initDockerProperties() {
|
||||
if (dockerHost.runningInDocker()) {
|
||||
// tell ebean-docker-test we are not using localhost (for jdbc DB setup commands)
|
||||
dockerProperties.setProperty(dockerKey("host"), dockerHost.dockerHost());
|
||||
}
|
||||
dockerProperties.setProperty(dockerKey("port"), String.valueOf(port));
|
||||
dockerProperties.setProperty(dockerKey("dbName"), databaseName);
|
||||
if (schema != null) {
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
package io.ebean.test.config.platform;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Helper to detect if running inside docker and determine host name for that case.
|
||||
*/
|
||||
class DockerHost {
|
||||
|
||||
private final boolean runningInDocker;
|
||||
private String dockerHost;
|
||||
|
||||
DockerHost() {
|
||||
runningInDocker = initInDocker();
|
||||
}
|
||||
|
||||
boolean runningInDocker() {
|
||||
return runningInDocker;
|
||||
}
|
||||
|
||||
String dockerHost() {
|
||||
return dockerHost;
|
||||
}
|
||||
|
||||
String dockerHost(String explicitHost) {
|
||||
if (!runningInDocker) {
|
||||
return "localhost";
|
||||
}
|
||||
dockerHost = explicitHost != null ? explicitHost : defaultDockerHost();
|
||||
return dockerHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if running inside a docker container (we are using docker in docker).
|
||||
*/
|
||||
boolean initInDocker() {
|
||||
return new File("/.dockerenv").exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default host name to use when running in docker.
|
||||
* <p>
|
||||
* Can instead be explicitly specified via <code>ebean.test.dockerHost</code>.
|
||||
*/
|
||||
String defaultDockerHost() {
|
||||
String os = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);
|
||||
if (os.contains("mac") || os.contains("darwin") || os.contains("win")) {
|
||||
return "host.docker.internal";
|
||||
} else {
|
||||
return "172.17.0.1";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,7 +44,7 @@
|
||||
<ebean-ddl-runner.version>2.0</ebean-ddl-runner.version>
|
||||
<ebean-migration-auto.version>1.2</ebean-migration-auto.version>
|
||||
<ebean-migration.version>13.6.0</ebean-migration.version>
|
||||
<ebean-test-containers.version>6.1</ebean-test-containers.version>
|
||||
<ebean-test-containers.version>6.2</ebean-test-containers.version>
|
||||
<ebean-datasource.version>8.0</ebean-datasource.version>
|
||||
<ebean-agent.version>13.6.5</ebean-agent.version>
|
||||
<ebean-maven-plugin.version>13.6.5</ebean-maven-plugin.version>
|
||||
|
||||
Reference in New Issue
Block a user