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 31ea174
Showing 1 changed file with 24 additions and 30 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,8 +318,8 @@ class SanityRoboCheck {
| legacy-junit-result: false
| full-junit-result: false
| output-style: single
"""
}
""".trimMargin()
)
}

private infix fun String.readAndCompareWith(block: () -> String) = testProjectRoot
Expand Down

0 comments on commit 31ea174

Please sign in to comment.