Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
CredentialsTest should always work on a safe test environment (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
francescocervone authored May 11, 2023
1 parent a4c4bdb commit 262a99f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/test/kotlin/CredentialsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CredentialsTest : GradleTest() {
File(testProjectDir.root, "build.gradle.kts")
.appendText("simpleFlank { projectId.set(\"my-project\") }")

val build = gradleRunner("flankRun", "--stacktrace").forwardOutput().buildAndFail()
val build = flankRun().forwardOutput().buildAndFail()

expectThat(build) {
output.contains(
Expand All @@ -31,7 +31,7 @@ class CredentialsTest : GradleTest() {
fun `When service account is provided using the default file, build is successful`() {
projectFromResources("app")

val build = gradleRunner("flankRun", "--stacktrace").forwardOutput().build()
val build = flankRun().forwardOutput().build()

expectThat(build) {
output
Expand All @@ -46,7 +46,7 @@ class CredentialsTest : GradleTest() {
fun `When service account is provided using the a custom file, build is successful`() {
projectFromResources("app")

val build = gradleRunner("flankRun", "--stacktrace").forwardOutput().build()
val build = flankRun().forwardOutput().build()
File(testProjectDir.root, "ftl-credentials.json").deleteRecursively()
File(testProjectDir.root, "custom-credentials.json")
.appendText("{ \"project_id\": \"custom-project-id\" }")
Expand All @@ -70,10 +70,7 @@ class CredentialsTest : GradleTest() {
.appendText("simpleFlank { projectId.set(\"my-project\") }")
userHomeDirectory.root.resolve(".flank").mkdir()

val build =
gradleRunner("flankRun", "-Duser.home=${userHomeDirectory.root.path}", "--stacktrace")
.forwardOutput()
.build()
val build = flankRun().forwardOutput().build()

expectThat(build) {
output
Expand All @@ -83,4 +80,7 @@ class CredentialsTest : GradleTest() {
taskPaths(TaskOutcome.SUCCESS).contains(":flankRunDebug")
}
}

private fun flankRun() =
gradleRunner("flankRun", "-Duser.home=${userHomeDirectory.root.path}", "--stacktrace")
}

0 comments on commit 262a99f

Please sign in to comment.