diff --git a/src/integrationMain/kotlin/com/liftric/vault/ContainerBase.kt b/src/integrationMain/kotlin/com/liftric/vault/ContainerBase.kt index 640132e..1d6e5ba 100644 --- a/src/integrationMain/kotlin/com/liftric/vault/ContainerBase.kt +++ b/src/integrationMain/kotlin/com/liftric/vault/ContainerBase.kt @@ -43,6 +43,13 @@ abstract class ContainerBase { "exampleint" to 1337, ) as Map? ) + + vault.logical().write( + "secret/example2", hashMapOf( + "examplestring2" to "helloworld2", + "exampleint2" to 1338, + ) as Map? + ) } } diff --git a/src/integrationMain/kotlin/com/liftric/vault/GetSecretTest.kt b/src/integrationMain/kotlin/com/liftric/vault/GetSecretTest.kt index d1eb545..54f43af 100644 --- a/src/integrationMain/kotlin/com/liftric/vault/GetSecretTest.kt +++ b/src/integrationMain/kotlin/com/liftric/vault/GetSecretTest.kt @@ -53,8 +53,14 @@ tasks { println("getting secret succeeded!") } } - val build by existing { - dependsOn(needsSecretsConfigTime, needsSecrets) + val needsSecrets2 by creating(GetVaultSecretTask::class) { + secretPath.set("secret/example2") + doLast { + val secret = secret.get() + if (secret["examplestring2"] != "helloworld2") throw kotlin.IllegalStateException("examplestring2 couldn't be read") + if (secret["exampleint2"]?.toInt() != 1338) throw kotlin.IllegalStateException("exampleint2 couldn't be read") + println("getting secret succeeded!") + } } } """ @@ -62,7 +68,7 @@ tasks { val result = GradleRunner.create() .withProjectDir(projectDir) - .withArguments("build") + .withArguments("needsSecrets", "needsSecrets2") .withPluginClasspath() .build()