mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Delete disabled docker compose tests
This commit is contained in:
parent
d55cd3b46f
commit
2bec82ab2f
@ -1,101 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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.springframework.boot.docker.compose.service.connection.elasticsearch;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests for {@link ElasticsearchDockerComposeConnectionDetailsFactory}.
|
|
||||||
*
|
|
||||||
* @author Moritz Halbritter
|
|
||||||
* @author Andy Wilkinson
|
|
||||||
* @author Phillip Webb
|
|
||||||
*/
|
|
||||||
@Disabled
|
|
||||||
class XElasticsearchDockerComposeConnectionDetailsFactoryTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void test() {
|
|
||||||
fail("Not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
// @formatter:off
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameIsElastic() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
ElasticsearchService elasticsearchService = new ElasticsearchService(service);
|
|
||||||
assertThat(elasticsearchService.getUsername()).isEqualTo("elastic");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("ELASTIC_PASSWORD", "some-secret-password"));
|
|
||||||
ElasticsearchService elasticsearchService = new ElasticsearchService(service);
|
|
||||||
assertThat(elasticsearchService.getPassword()).isEqualTo("some-secret-password");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordHasFallback() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
ElasticsearchService elasticsearchService = new ElasticsearchService(service);
|
|
||||||
assertThat(elasticsearchService.getPassword()).isNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordDoesNotSupportFile() {
|
|
||||||
RunningService service = createService(Map.of("ELASTIC_PASSWORD_FILE", "/password.txt"));
|
|
||||||
ElasticsearchService elasticsearchService = new ElasticsearchService(service);
|
|
||||||
assertThatThrownBy(elasticsearchService::getPassword).isInstanceOf(IllegalStateException.class)
|
|
||||||
.hasMessageContaining("ELASTIC_PASSWORD_FILE");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void getPort() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
ElasticsearchService elasticsearchService = new ElasticsearchService(service);
|
|
||||||
assertThat(elasticsearchService.getPort()).isEqualTo(19200);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void matches() {
|
|
||||||
assertThat(ElasticsearchService.matches(createService(Collections.emptyMap()))).isTrue();
|
|
||||||
assertThat(
|
|
||||||
ElasticsearchService.matches(createService(ImageReference.parse("redis:7.1"), Collections.emptyMap())))
|
|
||||||
.isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(Map<String, String> env) {
|
|
||||||
return createService(ImageReference.parse("elasticsearch:8.6.2"), env);
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(ImageReference image, Map<String, String> env) {
|
|
||||||
return RunningServiceBuilder.create("service-1", image).addTcpPort(9200, 19200).env(env).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
}
|
|
@ -1,190 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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.springframework.boot.docker.compose.service.connection.mariadb;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests for {@link XMariaDbDockerComposeConnectionDetailsFactoryTests}.
|
|
||||||
*
|
|
||||||
* @author Moritz Halbritter
|
|
||||||
* @author Andy Wilkinson
|
|
||||||
* @author Phillip Webb
|
|
||||||
*/
|
|
||||||
@Disabled
|
|
||||||
class XMariaDbDockerComposeConnectionDetailsFactoryTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void test() {
|
|
||||||
fail("Not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
// @formatter:off
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameUsesMariaDbVariables() {
|
|
||||||
RunningService service = createService(Map.of("MARIADB_USER", "user-1"));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getUsername()).isEqualTo("user-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameUsesMysqlVariables() {
|
|
||||||
RunningService service = createService(Map.of("MYSQL_USER", "user-1"));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getUsername()).isEqualTo("user-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameDefaultsToRoot() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getUsername()).isEqualTo("root");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordUsesMariaDbVariables() {
|
|
||||||
RunningService service = createService(Map.of("MARIADB_PASSWORD", "password-1"));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getPassword()).isEqualTo("password-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordUsesMysqlVariables() {
|
|
||||||
RunningService service = createService(Map.of("MYSQL_PASSWORD", "password-1"));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getPassword()).isEqualTo("password-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordUsesMariaDbRootVariables() {
|
|
||||||
RunningService service = createService(Map.of("MARIADB_ROOT_PASSWORD", "root-password-1"));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getPassword()).isEqualTo("root-password-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordUsesMysqlRootVariables() {
|
|
||||||
RunningService service = createService(Map.of("MYSQL_ROOT_PASSWORD", "root-password-1"));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getPassword()).isEqualTo("root-password-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordSupportsEmptyRootPasswordMariaDb() {
|
|
||||||
RunningService service = createService(Map.of("MARIADB_ALLOW_EMPTY_ROOT_PASSWORD", ""));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getPassword()).isEqualTo("");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordDoesNotSupportRootPasswordHash() {
|
|
||||||
RunningService service = createService(Map.of("MARIADB_ROOT_PASSWORD_HASH", "true"));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThatThrownBy(mariaDbService::getPassword).isInstanceOf(IllegalStateException.class)
|
|
||||||
.hasMessageContaining("MARIADB_ROOT_PASSWORD_HASH");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordDoesNotSupportRandomRootPasswordMariaDb() {
|
|
||||||
RunningService service = createService(Map.of("MARIADB_RANDOM_ROOT_PASSWORD", "true"));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThatThrownBy(mariaDbService::getPassword).isInstanceOf(IllegalStateException.class)
|
|
||||||
.hasMessageContaining("MARIADB_RANDOM_ROOT_PASSWORD");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordDoesNotSupportRandomRootPasswordMysql() {
|
|
||||||
RunningService service = createService(Map.of("MYSQL_RANDOM_ROOT_PASSWORD", "true"));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThatThrownBy(mariaDbService::getPassword).isInstanceOf(IllegalStateException.class)
|
|
||||||
.hasMessageContaining("MYSQL_RANDOM_ROOT_PASSWORD");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordHasNoFallback() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThatThrownBy(mariaDbService::getPassword).isInstanceOf(IllegalStateException.class)
|
|
||||||
.hasMessage("Can't find password for user");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordSupportsEmptyRootPasswordMysql() {
|
|
||||||
RunningService service = createService(Map.of("MYSQL_ALLOW_EMPTY_PASSWORD", ""));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getPassword()).isEqualTo("");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void databaseUsesMariaDbVariables() {
|
|
||||||
RunningService service = createService(Map.of("MARIADB_DATABASE", "database-1"));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getDatabase()).isEqualTo("database-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void databaseUsesMysqlVariables() {
|
|
||||||
RunningService service = createService(Map.of("MYSQL_DATABASE", "database-1"));
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getDatabase()).isEqualTo("database-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void databaseHasNoFallback() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThatThrownBy(mariaDbService::getDatabase).isInstanceOf(IllegalStateException.class)
|
|
||||||
.hasMessageContaining("MARIADB_DATABASE")
|
|
||||||
.hasMessageContaining("MYSQL_DATABASE");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void getPort() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
MariaDbService mariaDbService = new MariaDbService(service);
|
|
||||||
assertThat(mariaDbService.getPort()).isEqualTo(33060);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void matches() {
|
|
||||||
assertThat(MariaDbService.matches(createService(Collections.emptyMap()))).isTrue();
|
|
||||||
assertThat(MariaDbService.matches(createService(ImageReference.parse("redis:7.1"), Collections.emptyMap())))
|
|
||||||
.isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(Map<String, String> env) {
|
|
||||||
return createService(ImageReference.parse("mariadb:10.10"), env);
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(ImageReference image, Map<String, String> env) {
|
|
||||||
return RunningServiceBuilder.create("service-1", image).addTcpPort(3306, 33060).env(env).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
}
|
|
@ -1,130 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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.springframework.boot.docker.compose.service.connection.mongo;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests for {@link MongoDockerComposeConnectionDetailsFactory}.
|
|
||||||
*
|
|
||||||
* @author Moritz Halbritter
|
|
||||||
* @author Andy Wilkinson
|
|
||||||
* @author Phillip Webb
|
|
||||||
*/
|
|
||||||
@Disabled
|
|
||||||
class XMongoDockerComposeConnectionDetailsFactoryTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void test() {
|
|
||||||
fail("Not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
// @formatter:off
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("MONGO_INITDB_ROOT_USERNAME", "user-1"));
|
|
||||||
MongoService mongoService = new MongoService(service);
|
|
||||||
assertThat(mongoService.getUsername()).isEqualTo("user-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void doesNotSupportUsernameFile() {
|
|
||||||
RunningService service = createService(Map.of("MONGO_INITDB_ROOT_USERNAME_FILE", "/username.txt"));
|
|
||||||
MongoService mongoService = new MongoService(service);
|
|
||||||
assertThatThrownBy(mongoService::getUsername).isInstanceOf(IllegalStateException.class)
|
|
||||||
.hasMessage("MONGO_INITDB_ROOT_USERNAME_FILE is not supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameHasDefault() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
MongoService mongoService = new MongoService(service);
|
|
||||||
assertThat(mongoService.getUsername()).isNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("MONGO_INITDB_ROOT_PASSWORD", "some-secret-1"));
|
|
||||||
MongoService mongoService = new MongoService(service);
|
|
||||||
assertThat(mongoService.getPassword()).isEqualTo("some-secret-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void doesNotSupportPasswordFile() {
|
|
||||||
RunningService service = createService(Map.of("MONGO_INITDB_ROOT_PASSWORD_FILE", "/username.txt"));
|
|
||||||
MongoService mongoService = new MongoService(service);
|
|
||||||
assertThatThrownBy(mongoService::getPassword).isInstanceOf(IllegalStateException.class)
|
|
||||||
.hasMessage("MONGO_INITDB_ROOT_PASSWORD_FILE is not supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordHasDefault() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
MongoService mongoService = new MongoService(service);
|
|
||||||
assertThat(mongoService.getPassword()).isNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void databaseUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("MONGO_INITDB_DATABASE", "database-1"));
|
|
||||||
MongoService mongoService = new MongoService(service);
|
|
||||||
assertThat(mongoService.getDatabase()).isEqualTo("database-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void databaseHasDefault() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
MongoService mongoService = new MongoService(service);
|
|
||||||
assertThat(mongoService.getDatabase()).isNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void getPort() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
MongoService mongoService = new MongoService(service);
|
|
||||||
assertThat(mongoService.getPort()).isEqualTo(12345);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void matches() {
|
|
||||||
assertThat(MongoService.matches(createService(Collections.emptyMap()))).isTrue();
|
|
||||||
assertThat(MongoService.matches(createService(ImageReference.parse("redis:7.1"), Collections.emptyMap())))
|
|
||||||
.isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(Map<String, String> env) {
|
|
||||||
return createService(ImageReference.parse("mongo:6.0"), env);
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(ImageReference image, Map<String, String> env) {
|
|
||||||
return RunningServiceBuilder.create("service-1", image).addTcpPort(27017, 12345).env(env).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
}
|
|
@ -1,115 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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.springframework.boot.docker.compose.service.connection.postgres;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests for {@link PostgresR2dbcDockerComposeConnectionDetailsFactory}.
|
|
||||||
*
|
|
||||||
* @author Moritz Halbritter
|
|
||||||
* @author Andy Wilkinson
|
|
||||||
* @author Phillip Webb
|
|
||||||
*/
|
|
||||||
@Disabled
|
|
||||||
class XPostgresDbR2dbcDockerComposeConnectionDetailsFactoryTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void test() {
|
|
||||||
fail("Not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
// @formatter:off
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("POSTGRES_USER", "user-1"));
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getUsername()).isEqualTo("user-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameHasFallback() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getUsername()).isEqualTo("postgres");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("POSTGRES_PASSWORD", "password-1"));
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getPassword()).isEqualTo("password-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordHasNoFallback() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThatThrownBy(postgresService::getPassword).isInstanceOf(IllegalStateException.class)
|
|
||||||
.hasMessageContaining("POSTGRES_PASSWORD");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void databaseUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("POSTGRES_DB", "database-1"));
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getDatabase()).isEqualTo("database-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void databaseFallsBackToUsername() {
|
|
||||||
RunningService service = createService(Map.of("POSTGRES_USER", "user-1"));
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getDatabase()).isEqualTo("user-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void getPort() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getPort()).isEqualTo(54320);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void matches() {
|
|
||||||
assertThat(PostgresService.matches(createService(Collections.emptyMap()))).isTrue();
|
|
||||||
assertThat(PostgresService.matches(createService(ImageReference.parse("redis:7.1"), Collections.emptyMap())))
|
|
||||||
.isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(Map<String, String> env) {
|
|
||||||
return createService(ImageReference.parse("postgres:15.2"), env);
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(ImageReference image, Map<String, String> env) {
|
|
||||||
return RunningServiceBuilder.create("service-1", image).addTcpPort(5432, 54320).env(env).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
}
|
|
@ -1,115 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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.springframework.boot.docker.compose.service.connection.postgres;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests for {@link PostgresJdbcDockerComposeConnectionDetailsFactory}.
|
|
||||||
*
|
|
||||||
* @author Moritz Halbritter
|
|
||||||
* @author Andy Wilkinson
|
|
||||||
* @author Phillip Webb
|
|
||||||
*/
|
|
||||||
@Disabled
|
|
||||||
class XPostgresJdbcDockerComposeConnectionDetailsFactoryTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void test() {
|
|
||||||
fail("Not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
// @formatter:off
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("POSTGRES_USER", "user-1"));
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getUsername()).isEqualTo("user-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameHasFallback() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getUsername()).isEqualTo("postgres");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("POSTGRES_PASSWORD", "password-1"));
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getPassword()).isEqualTo("password-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordHasNoFallback() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThatThrownBy(postgresService::getPassword).isInstanceOf(IllegalStateException.class)
|
|
||||||
.hasMessageContaining("POSTGRES_PASSWORD");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void databaseUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("POSTGRES_DB", "database-1"));
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getDatabase()).isEqualTo("database-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void databaseFallsBackToUsername() {
|
|
||||||
RunningService service = createService(Map.of("POSTGRES_USER", "user-1"));
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getDatabase()).isEqualTo("user-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void getPort() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
PostgresService postgresService = new PostgresService(service);
|
|
||||||
assertThat(postgresService.getPort()).isEqualTo(54320);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void matches() {
|
|
||||||
assertThat(PostgresService.matches(createService(Collections.emptyMap()))).isTrue();
|
|
||||||
assertThat(PostgresService.matches(createService(ImageReference.parse("redis:7.1"), Collections.emptyMap())))
|
|
||||||
.isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(Map<String, String> env) {
|
|
||||||
return createService(ImageReference.parse("postgres:15.2"), env);
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(ImageReference image, Map<String, String> env) {
|
|
||||||
return RunningServiceBuilder.create("service-1", image).addTcpPort(5432, 54320).env(env).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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.springframework.boot.docker.compose.service.connection.rabbit;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests for {@link RabbitDockerComposeConnectionDetailsFactory}
|
|
||||||
*
|
|
||||||
* @author Moritz Halbritter
|
|
||||||
* @author Andy Wilkinson
|
|
||||||
* @author Phillip Webb
|
|
||||||
*/
|
|
||||||
@Disabled
|
|
||||||
class XRabbitDockerComposeConnectionDetailsFactoryTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void test() {
|
|
||||||
fail("Not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
// @formatter:off
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("RABBITMQ_DEFAULT_USER", "user-1"));
|
|
||||||
RabbitService rabbitService = new RabbitService(service);
|
|
||||||
assertThat(rabbitService.getUsername()).isEqualTo("user-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void usernameHasDefault() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
RabbitService rabbitService = new RabbitService(service);
|
|
||||||
assertThat(rabbitService.getUsername()).isEqualTo("guest");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordUsesEnvVariable() {
|
|
||||||
RunningService service = createService(Map.of("RABBITMQ_DEFAULT_PASS", "secret-1"));
|
|
||||||
RabbitService rabbitService = new RabbitService(service);
|
|
||||||
assertThat(rabbitService.getPassword()).isEqualTo("secret-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void passwordHasDefault() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
RabbitService rabbitService = new RabbitService(service);
|
|
||||||
assertThat(rabbitService.getPassword()).isEqualTo("guest");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void getPort() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
RabbitService rabbitService = new RabbitService(service);
|
|
||||||
assertThat(rabbitService.getPort()).isEqualTo(15672);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void matches() {
|
|
||||||
assertThat(RabbitService.matches(createService(Collections.emptyMap()))).isTrue();
|
|
||||||
assertThat(RabbitService.matches(createService(ImageReference.parse("redis:7.1"), Collections.emptyMap())))
|
|
||||||
.isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(Map<String, String> env) {
|
|
||||||
return createService(ImageReference.parse("rabbitmq:3.11"), env);
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(ImageReference image, Map<String, String> env) {
|
|
||||||
return RunningServiceBuilder.create("service-1", image).addTcpPort(5672, 15672).env(env).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2012-2023 the original author or authors.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* https://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.springframework.boot.docker.compose.service.connection.redis;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests for {@link RedisDockerComposeConnectionDetailsFactory}.
|
|
||||||
*
|
|
||||||
* @author Moritz Halbritter
|
|
||||||
* @author Andy Wilkinson
|
|
||||||
* @author Phillip Webb
|
|
||||||
*/
|
|
||||||
@Disabled
|
|
||||||
class RedisDockerComposeConnectionDetailsFactoryTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void test() {
|
|
||||||
fail("Not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
// @formatter:off
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void getPort() {
|
|
||||||
RunningService service = createService(Collections.emptyMap());
|
|
||||||
RedisService redisService = new RedisService(service);
|
|
||||||
assertThat(redisService.getPort()).isEqualTo(16379);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void matches() {
|
|
||||||
assertThat(RedisService.matches(createService(Collections.emptyMap()))).isTrue();
|
|
||||||
assertThat(RedisService.matches(createService(ImageReference.parse("postgres:15.2"), Collections.emptyMap())))
|
|
||||||
.isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(Map<String, String> env) {
|
|
||||||
return createService(ImageReference.parse("redis:7.0"), env);
|
|
||||||
}
|
|
||||||
|
|
||||||
private RunningService createService(ImageReference image, Map<String, String> env) {
|
|
||||||
return RunningServiceBuilder.create("service-1", image).addTcpPort(6379, 16379).env(env).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user