Skip to content

Commit d9c6386

Browse files
committed
OrtConfigurationTest: Extend the prioritization test
Also show how to override the password for a `postgresStorage`. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 2938c72 commit d9c6386

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

model/src/test/kotlin/config/OrtConfigurationTest.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,20 @@ class OrtConfigurationTest : WordSpec({
248248
schema: public
249249
username: username
250250
password: password
251+
provenanceStorage:
252+
postgresStorage:
253+
connection:
254+
url: "postgresql://your-postgresql-server:5444/your-database"
255+
schema: public
256+
username: username
257+
password: password
251258
""".trimIndent()
252259
)
253260

254-
val env = mapOf("ort.scanner.storages.postgres.connection.password" to "envPassword")
261+
val env = mapOf(
262+
"ort.scanner.storages.postgres.connection.password" to "envPassword",
263+
"ort.scanner.provenanceStorage.postgresStorage.connection.password" to "envPassword"
264+
)
255265

256266
withEnvironment(env) {
257267
val config = OrtConfiguration.load(
@@ -272,6 +282,16 @@ class OrtConfigurationTest : WordSpec({
272282
password shouldBe "envPassword"
273283
}
274284
}
285+
286+
config.scanner.provenanceStorage shouldNotBeNull {
287+
postgresStorage.shouldBeInstanceOf<PostgresStorageConfiguration>().also { postgresStorage ->
288+
with(postgresStorage.connection) {
289+
username shouldBe "username"
290+
schema shouldBe "public"
291+
password shouldBe "envPassword"
292+
}
293+
}
294+
}
275295
}
276296
}
277297

0 commit comments

Comments
 (0)