fix requests

This commit is contained in:
emelianov
2026-06-01 14:22:36 +03:00
parent e5fd2a4586
commit 78887dd63a
2 changed files with 47 additions and 0 deletions
@@ -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")
}
}