work on tests

This commit is contained in:
Timo Bejan 2021-09-16 16:33:01 +03:00
parent 7e13d8d466
commit cdbcdcff38
2 changed files with 23 additions and 1 deletions

View File

@ -55,8 +55,9 @@ public abstract class AbstractPersistenceServerServiceTest {
@MockBean
protected PDFTronRedactionClient pdfTronRedactionClient;
@ClassRule
public static PostgreSQLContainer postgreSQLContainer = new PostgreSQLContainer("postgres:11.1")
public static PostgreSQLContainer postgreSQLContainer = SpringPostgreSQLTestContainer.getInstance()
.withDatabaseName("integration-tests-db")
.withUsername("sa")
.withPassword("sa");

View File

@ -0,0 +1,21 @@
package com.iqser.red.service.peristence.v1.server.integration.utils;
import org.testcontainers.containers.PostgreSQLContainer;
public class SpringPostgreSQLTestContainer extends PostgreSQLContainer<SpringPostgreSQLTestContainer> {
private static final String IMAGE_VERSION = "postgres:11.1";
private static SpringPostgreSQLTestContainer container;
private SpringPostgreSQLTestContainer() {
super(IMAGE_VERSION);
}
public static SpringPostgreSQLTestContainer getInstance() {
if (container == null) {
container = new SpringPostgreSQLTestContainer();
}
return container;
}
}