Skip to content

Commit

Permalink
Refactor sanity check test
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelpasterz committed Sep 25, 2020
1 parent bcff85f commit 779ca80
Showing 1 changed file with 24 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ class SanityRoboCheck {
)

val result = gradleRun(
arguments = listOf("writeConfigProps", "-PsanityRobo"),
arguments = listOf("printYml", "-PsanityRobo"),
projectDir = testProjectRoot.root
)

assertThat(result.output).contains("SUCCESS")

"build/fladle/flank.yml" readAndCompareWith {
assertThat(result.output).contains(
"""
|gcloud:
| app: foo.apk
Expand All @@ -60,8 +59,8 @@ class SanityRoboCheck {
| legacy-junit-result: false
| full-junit-result: false
| output-style: single
"""
}
""".trimMargin()
)
}

@Test
Expand All @@ -88,13 +87,12 @@ class SanityRoboCheck {
)

val result = gradleRun(
arguments = listOf("writeConfigProps", "-PsanityRobo"),
arguments = listOf("printYml", "-PsanityRobo"),
projectDir = testProjectRoot.root
)

assertThat(result.output).contains("SUCCESS")

"build/fladle/flank.yml" readAndCompareWith {
assertThat(result.output).contains(
"""
|gcloud:
| app: foo.apk
Expand All @@ -117,8 +115,8 @@ class SanityRoboCheck {
| legacy-junit-result: false
| full-junit-result: false
| output-style: single
"""
}
""".trimMargin()
)
}

@Test
Expand Down Expand Up @@ -151,13 +149,12 @@ class SanityRoboCheck {
)

val result = gradleRun(
arguments = listOf("writeConfigProps", "-PsanityRobo"),
arguments = listOf("printYml", "-PsanityRobo"),
projectDir = testProjectRoot.root
)

assertThat(result.output).contains("SUCCESS")

"build/fladle/flank.yml" readAndCompareWith {
assertThat(result.output).contains(
"""
|gcloud:
| app: foo.apk
Expand All @@ -180,17 +177,16 @@ class SanityRoboCheck {
| legacy-junit-result: false
| full-junit-result: false
| output-style: single
"""
}
""".trimMargin()
)

val resultOrange = gradleRun(
arguments = listOf("writeConfigPropsOrange", "-PsanityRobo"),
arguments = listOf("printYmlOrange", "-PsanityRobo"),
projectDir = testProjectRoot.root
)

assertThat(resultOrange.output).contains("SUCCESS")

"build/fladle/orange/flank.yml" readAndCompareWith {
assertThat(resultOrange.output).contains(
"""
|gcloud:
| app: foo.apk
Expand All @@ -216,8 +212,8 @@ class SanityRoboCheck {
| legacy-junit-result: false
| full-junit-result: false
| output-style: single
"""
}
""".trimMargin()
)
}

@Test
Expand All @@ -239,13 +235,12 @@ class SanityRoboCheck {
)

val result = gradleRun(
arguments = listOf("writeConfigProps", "-PsanityRobo"),
arguments = listOf("printYml", "-PsanityRobo"),
projectDir = testProjectRoot.root
)

assertThat(result.output).contains("SUCCESS")

"build/fladle/flank.yml" readAndCompareWith {
assertThat(result.output).contains(
"""
|gcloud:
| app: foo.apk
Expand All @@ -268,8 +263,8 @@ class SanityRoboCheck {
| legacy-junit-result: false
| full-junit-result: false
| output-style: single
"""
}
""".trimMargin()
)
}

@Test
Expand All @@ -295,13 +290,12 @@ class SanityRoboCheck {
)

val result = gradleRun(
arguments = listOf("writeConfigProps", "-PsanityRobo"),
arguments = listOf("printYml", "-PsanityRobo"),
projectDir = testProjectRoot.root
)

assertThat(result.output).contains("SUCCESS")

"build/fladle/flank.yml" readAndCompareWith {
assertThat(result.output).contains(
"""
|gcloud:
| app: foo.apk
Expand All @@ -324,15 +318,7 @@ class SanityRoboCheck {
| legacy-junit-result: false
| full-junit-result: false
| output-style: single
"""
}
""".trimMargin()
)
}

private infix fun String.readAndCompareWith(block: () -> String) = testProjectRoot
.root
.resolve(this)
.readText()
.run {
assertThat(this).contains(block().trimMargin())
}
}

0 comments on commit 779ca80

Please sign in to comment.