fix requests
This commit is contained in:
@@ -67,3 +67,14 @@ app:
|
|||||||
cleanup-cron: "0 0 3 * * *"
|
cleanup-cron: "0 0 3 * * *"
|
||||||
grid:
|
grid:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
config:
|
||||||
|
activate:
|
||||||
|
on-profile: local
|
||||||
|
datasource:
|
||||||
|
driver-class-name: org.postgresql.Driver
|
||||||
|
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_requests
|
||||||
|
username: postgres
|
||||||
|
password: password
|
||||||
|
|||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
package org.nstart.dep265.requestservice
|
||||||
|
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.Path
|
||||||
|
import kotlin.io.path.readText
|
||||||
|
import kotlin.test.Test
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
|
class RequestServiceConfigTest {
|
||||||
|
@Test
|
||||||
|
fun `local profile uses concrete postgres datasource`() {
|
||||||
|
val config = configRepositoryFile().readText()
|
||||||
|
|
||||||
|
assertTrue(config.contains("on-profile: local"))
|
||||||
|
assertTrue(config.contains("url: jdbc:postgresql://\${pcp.infra.postgres.host}:\${pcp.infra.postgres.port}/pcp_requests"))
|
||||||
|
assertTrue(config.contains("username: postgres"))
|
||||||
|
assertTrue(config.contains("password: password"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `shared datasource keeps environment placeholders for deployed profiles`() {
|
||||||
|
val config = configRepositoryFile().readText()
|
||||||
|
|
||||||
|
assertTrue(config.contains("url: \"\${SPRING_DATASOURCE_URL}\""))
|
||||||
|
assertTrue(config.contains("username: \"\${SPRING_DATASOURCE_USERNAME}\""))
|
||||||
|
assertTrue(config.contains("password: \"\${SPRING_DATASOURCE_PASSWORD}\""))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun configRepositoryFile(): Path {
|
||||||
|
val rootPath = Path.of("config-repo/pcp-request-service.yaml")
|
||||||
|
if (Files.exists(rootPath)) {
|
||||||
|
return rootPath
|
||||||
|
}
|
||||||
|
return Path.of("../../config-repo/pcp-request-service.yaml")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user