diff --git a/model/src/test/kotlin/config/OrtConfigurationTest.kt b/model/src/test/kotlin/config/OrtConfigurationTest.kt index 6accf2cd0f29..a6ad98fa909c 100644 --- a/model/src/test/kotlin/config/OrtConfigurationTest.kt +++ b/model/src/test/kotlin/config/OrtConfigurationTest.kt @@ -242,6 +242,13 @@ class OrtConfigurationTest : WordSpec({ ort: scanner: storages: + postgres: + connection: + url: "postgresql://your-postgresql-server:5444/your-database" + schema: public + username: username + password: password + provenanceStorage: postgresStorage: connection: url: "postgresql://your-postgresql-server:5444/your-database" @@ -251,20 +258,23 @@ class OrtConfigurationTest : WordSpec({ """.trimIndent() ) - val env = mapOf("ort.scanner.storages.postgresStorage.connection.password" to "envPassword") + val env = mapOf( + "ort.scanner.storages.postgres.connection.password" to "envPassword", + "ort.scanner.provenanceStorage.postgresStorage.connection.password" to "envPassword" + ) withEnvironment(env) { val config = OrtConfiguration.load( args = mapOf( - "ort.scanner.storages.postgresStorage.connection.schema" to "argsSchema", - "ort.scanner.storages.postgresStorage.connection.password" to "argsPassword", + "ort.scanner.storages.postgres.connection.schema" to "argsSchema", + "ort.scanner.storages.postgres.connection.password" to "argsPassword", "other.property" to "someValue" ), file = configFile ) config.scanner.storages shouldNotBeNull { - val postgresStorage = this["postgresStorage"] + val postgresStorage = this["postgres"] postgresStorage.shouldBeInstanceOf() with(postgresStorage.connection) { username shouldBe "username" @@ -272,6 +282,16 @@ class OrtConfigurationTest : WordSpec({ password shouldBe "envPassword" } } + + config.scanner.provenanceStorage shouldNotBeNull { + postgresStorage.shouldBeInstanceOf().also { postgresStorage -> + with(postgresStorage.connection) { + username shouldBe "username" + schema shouldBe "public" + password shouldBe "envPassword" + } + } + } } }