1616import org .testcontainers .containers .GenericContainer ;
1717
1818import java .sql .Connection ;
19+ import java .sql .DriverManager ;
1920import java .sql .SQLException ;
2021import java .util .Arrays ;
22+ import java .util .Collections ;
2123import java .util .List ;
2224import java .util .Map ;
2325
@@ -33,6 +35,7 @@ public class EmbeddedEvoMasterController extends EmbeddedSutController {
3335 .withEnv ("POSTGRES_PASSWORD" , POSTGRES_PASSWORD )
3436 .withEnv ("POSTGRES_HOST_AUTH_METHOD" , "trust" ) //to allow all connections without a password
3537 .withEnv ("POSTGRES_DB" , "familietilbake" )
38+ .withTmpFs (Collections .singletonMap ("/var/lib/postgresql/data" , "rw" ))
3639 .withExposedPorts (POSTGRES_PORT );
3740
3841 private ConfigurableApplicationContext ctx ;
@@ -62,7 +65,7 @@ public static void main(String[] args) {
6265
6366 @ Override
6467 public boolean isSutRunning () {
65- return ctx .isRunning ();
68+ return ctx != null && ctx .isRunning ();
6669 }
6770
6871 @ Override
@@ -78,7 +81,7 @@ public List<AuthenticationDto> getInfoForAuthentication() {
7881 @ Override
7982 public ProblemInfo getProblemInfo () {
8083 return new RestProblem (
81- "http://localhost:" + getSutPort () + "/assets/swagger.json " ,
84+ "http://localhost:" + getSutPort () + "/v3/api-docs " ,
8285 null
8386 );
8487 }
@@ -94,8 +97,9 @@ public String startSut() {
9497
9598 String postgresURL = "jdbc:postgresql://" + postgresContainer .getHost () + ":" + postgresContainer .getMappedPort (POSTGRES_PORT ) + "/familietilbake" ;
9699
97- System .setProperty ("AZURE_OPENID_CONFIG_TOKEN_ENDPOINT" , "http://localhost:8080/" );
98- System .setProperty ("UNLEASH_SERVER_API_URL" , "http://localhost:8080/" );
100+ System .setProperty ("AZURE_APP_WELL_KNOWN_URL" , "http://azure:8080/" );
101+ System .setProperty ("AZURE_OPENID_CONFIG_TOKEN_ENDPOINT" , "http://foo:8080/" );
102+ System .setProperty ("UNLEASH_SERVER_API_URL" , "http://bar:8080/" );
99103 System .setProperty ("UNLEASH_SERVER_API_TOKEN" , "71c722758740d43341c295ffdc237bd3" );
100104 System .setProperty ("NAIS_APP_NAME" , "familietilbake" );
101105 System .setProperty ("NAIS_CLUSTER_NAME" , "dev-gcp" );
@@ -112,14 +116,10 @@ public String startSut() {
112116 "--sentry.logging.enabled=false" ,
113117 "--sentry.environment=local" ,
114118 "--logging.level.root=OFF" ,
115- "--logback.configurationFile=src/main/resources/logback.xml" ,
116- "--logging.level.org.springframework=OFF" ,
117- "--spring.main.web-application-type=none"
119+ "--logging.config=classpath:logback-spring.xml" ,
120+ "--logging.level.org.springframework=INFO"
118121 });
119122
120- // https://www.baeldung.com/spring-boot-application-context-exception
121- // spring.main.web-application-type=none
122-
123123 if (sqlConnection != null ) {
124124 try {
125125 sqlConnection .close ();
@@ -128,8 +128,8 @@ public String startSut() {
128128 }
129129 }
130130
131- JdbcTemplate jdbc = ctx . getBean ( JdbcTemplate . class ); try {
132- sqlConnection = jdbc . getDataSource (). getConnection ();
131+ try {
132+ sqlConnection = DriverManager . getConnection (postgresURL , "postgres" , POSTGRES_PASSWORD );
133133 } catch (SQLException e ) {
134134 throw new RuntimeException (e );
135135 }
@@ -148,13 +148,11 @@ protected int getSutPort() {
148148 @ Override
149149 public void stopSut () {
150150 postgresContainer .stop ();
151- ctx .stop ();
151+ if ( ctx != null ) ctx .stop ();
152152 }
153153
154154 @ Override
155155 public void resetStateOfSUT () {
156- // TODO: check and see for any necessary steps required
157- DbCleaner .clearDatabase (sqlConnection , List .of (), DatabaseType .POSTGRES );
158156 }
159157
160158 @ Override
0 commit comments