There are several tests in my Spring boot application that port perfectly on my local machine, but crash on Heroku:
org.h2.jdbc.JdbcSQLException: Exception opening port "8082" (port may be in use), cause: "java.net.BindException: Address already in use (Bind failed)" [90061-196]
Profile data source configuration test:
@Configuration
public class TestDataSourceConfiguration {
@Bean
@ConfigurationProperties(prefix = "spring.datasource")
@Profile("test")
public DataSource testDataSource() throws URISyntaxException {
return DataSourceBuilder.create().build();
}
}
application-test.properties: spring.datasource.url = JDBC: h2: MEM: tesdb; DB_CLOSE_DELAY = -1; DB_CLOSE_ON_EXIT = FALSE, spring.datasource.driverClassName = org.h2.Driver spring.datasource.username = ca spring.datasource.password =
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
I know Heroku does not support h2, but it should not be here, as the application itself raises db, right?
, , - , Heroku h2, , 8082 ( , )