Skip to content

Commit

Permalink
Rename testRuns to repeatTests (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
bootstraponline authored Sep 9, 2018
1 parent c06bce1 commit 27cad6d
Show file tree
Hide file tree
Showing 21 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions test_runner/flank.ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ flank:
# test shards - the amount of groups to split the test suite into
# set to -1 to use one shard per test.
testShards: 1
# test runs - the amount of times to run the tests.
# repeat tests - the amount of times to run the tests.
# 1 runs the tests once. 10 runs all the tests 10x
testRuns: 1
repeatTests: 1
# # always run - these tests are inserted at the beginning of every shard
# # useful if you need to grant permissions or login before other tests run
# test-targets-always-run:
Expand Down
4 changes: 2 additions & 2 deletions test_runner/flank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ flank:
# test shards - the amount of groups to split the test suite into
# set to -1 to use one shard per test.
testShards: 1
# test runs - the amount of times to run the tests.
# repeat tests - the amount of times to run the tests.
# 1 runs the tests once. 10 runs all the tests 10x
testRuns: 1
repeatTests: 1
# # always run - these tests are inserted at the beginning of every shard
# # useful if you need to grant permissions or login before other tests run
# test-targets-always-run:
Expand Down
4 changes: 2 additions & 2 deletions test_runner/src/main/kotlin/ftl/args/AndroidArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AndroidArgs(

private val flank = flankYml.flank
val testShards = flank.testShards
override val testRuns = flank.testRuns
override val repeatTests = flank.repeatTests
val testTargetsAlwaysRun = flank.testTargetsAlwaysRun

// computed properties not specified in yaml
Expand Down Expand Up @@ -124,7 +124,7 @@ AndroidArgs
flank:
testShards: $testShards
testRuns: $testRuns
repeatTests: $repeatTests
testTargetsAlwaysRun: $testTargetsAlwaysRun
""".trimIndent()
}
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/args/IArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ interface IArgs {
val async: Boolean
val resultsBucket: String
val projectId: String
val testRuns: Int
val repeatTests: Int
val testShardChunks: List<List<String>>
}
4 changes: 2 additions & 2 deletions test_runner/src/main/kotlin/ftl/args/IosArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class IosArgs(

private val flank = flankYml.flank
val testShards = flank.testShards
override val testRuns = flank.testRuns
override val repeatTests = flank.repeatTests
val testTargetsAlwaysRun = flank.testTargetsAlwaysRun

private val iosFlank = iosFlankYml.flank
Expand Down Expand Up @@ -89,7 +89,7 @@ IosArgs
flank:
testShards: $testShards
testRuns: $testRuns
repeatTests: $repeatTests
testTargetsAlwaysRun: $testTargetsAlwaysRun
# iOS flank
testTargets: $testTargets
Expand Down
6 changes: 3 additions & 3 deletions test_runner/src/main/kotlin/ftl/args/yml/FlankYml.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import ftl.util.Utils.fatalError
@JsonIgnoreProperties(ignoreUnknown = true)
class FlankYmlParams(
val testShards: Int = 1,
val testRuns: Int = 1,
val repeatTests: Int = 1,

@field:JsonProperty("test-targets-always-run")
val testTargetsAlwaysRun: List<String> = emptyList()
) {
companion object : IYmlKeys {
override val keys = listOf("testShards", "testRuns", "test-targets-always-run")
override val keys = listOf("testShards", "repeatTests", "test-targets-always-run")
}

init {
if (testShards <= 0 && testShards != -1) fatalError("testShards must be >= 1 or -1")
if (testRuns < 1) fatalError("testRuns must be >= 1")
if (repeatTests < 1) fatalError("repeatTests must be >= 1")
}
}

Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/run/AndroidTestRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object AndroidTestRunner {

val apks = resolveApks(androidArgs, runGcsPath)
val jobs = arrayListOf<Deferred<TestMatrix>>()
val runCount = androidArgs.testRuns
val runCount = androidArgs.repeatTests
val deviceCount = androidArgs.testShardChunks.size
val shardCounter = ShardCounter()

Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/run/GenericTestRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ object GenericTestRunner {
}

fun beforeRunMessage(args: IArgs): String {
val runCount = args.testRuns
val runCount = args.repeatTests
val shardCount = args.testShardChunks.size
val testsPerShard = args.testShardChunks.first().size
val testsCount = args.testShardChunks.sumBy { it.size }
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/run/IosTestRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object IosTestRunner {
val xcTestParsed = Xctestrun.parse(yamlConfig.xctestrunFile)

val jobs = arrayListOf<Deferred<TestMatrix>>()
val runCount = yamlConfig.testRuns
val runCount = yamlConfig.repeatTests
val deviceCount = yamlConfig.testShardChunks.size
val shardCounter = ShardCounter()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class AndroidArgsFileTest {

with(config) {
assert(testShards, 1)
assert(testRuns, 1)
assert(repeatTests, 1)
}
}

Expand Down
8 changes: 4 additions & 4 deletions test_runner/src/test/kotlin/ftl/args/AndroidArgsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AndroidArgsTest {
flank:
testShards: 7
testRuns: 8
repeatTests: 8
test-targets-always-run:
- class example.Test#grantPermission
"""
Expand Down Expand Up @@ -124,7 +124,7 @@ class AndroidArgsTest {

// FlankYml
assert(testShards, 7)
assert(testRuns, 8)
assert(repeatTests, 8)
assert(testTargetsAlwaysRun, listOf("class example.Test#grantPermission"))
}
}
Expand Down Expand Up @@ -154,7 +154,7 @@ AndroidArgs
flank:
testShards: 7
testRuns: 8
repeatTests: 8
testTargetsAlwaysRun: [class example.Test#grantPermission]
""".trimIndent()
)
Expand Down Expand Up @@ -191,7 +191,7 @@ AndroidArgs

// FlankYml
assert(testShards, 1)
assert(testRuns, 1)
assert(repeatTests, 1)
assert(testTargetsAlwaysRun, empty)
}
}
Expand Down
8 changes: 4 additions & 4 deletions test_runner/src/test/kotlin/ftl/args/FlankYmlTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class FlankYmlTest {
fun testValidArgs() {
FlankYml()
FlankYml(FlankYmlParams(testShards = -1))
val yml = FlankYml(FlankYmlParams(testShards = 1, testRuns = 1))
assertThat(yml.flank.testRuns).isEqualTo(1)
val yml = FlankYml(FlankYmlParams(testShards = 1, repeatTests = 1))
assertThat(yml.flank.repeatTests).isEqualTo(1)
assertThat(yml.flank.testShards).isEqualTo(1)
assertThat(yml.flank.testTargetsAlwaysRun).isEqualTo(emptyList<String>())
assertThat(FlankYml.map).isNotEmpty()
Expand All @@ -39,8 +39,8 @@ class FlankYmlTest {
}

@Test
fun testInvalidTestRuns() {
fun testInvalidrepeatTests() {
expectedExitRule.expectSystemExitWithStatus(-1)
FlankYml(FlankYmlParams(testRuns = 0))
FlankYml(FlankYmlParams(repeatTests = 0))
}
}
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/ftl/args/IosArgsFileTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class IosArgsFileTest {
)
)
assert(testShards, 1)
assert(testRuns, 1)
assert(repeatTests, 1)
}
}

Expand Down
8 changes: 4 additions & 4 deletions test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class IosArgsTest {
flank:
testShards: 7
testRuns: 8
repeatTests: 8
test-targets-always-run:
- a/testGrantPermissions
test-targets:
Expand Down Expand Up @@ -84,7 +84,7 @@ class IosArgsTest {

// FlankYml
assert(testShards, 7)
assert(testRuns, 8)
assert(repeatTests, 8)
assert(testTargetsAlwaysRun, listOf("a/testGrantPermissions"))

// IosFlankYml
Expand All @@ -111,7 +111,7 @@ IosArgs
flank:
testShards: 7
testRuns: 8
repeatTests: 8
testTargetsAlwaysRun: [a/testGrantPermissions]
# iOS flank
testTargets: [b/testBasicSelection]
Expand Down Expand Up @@ -144,7 +144,7 @@ IosArgs

// FlankYml
assert(testShards, 1)
assert(testRuns, 1)
assert(repeatTests, 1)
assert(testTargetsAlwaysRun, emptyList<String>())

// IosFlankYml
Expand Down
4 changes: 2 additions & 2 deletions test_runner/src/test/kotlin/ftl/doctor/DoctorTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ gcloud:
flank:
testShards: 7
testRuns: 8
repeatTests: 8
test-targets-always-run:
- .
three: .
Expand Down Expand Up @@ -98,7 +98,7 @@ gcloud:
flank:
testShards: .
testRuns: .
repeatTests: .
test-targets-always-run:
- .
test-targets:
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/ftl/fixtures/flank.gcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ gcloud:

flank:
testShards: 1
testRuns: 1
repeatTests: 1
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/ftl/fixtures/flank.ios.gcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ flank:
test-targets:
- EarlGreyExampleMixedTests/testBasicSelection
testShards: 1
testRuns: 1
repeatTests: 1
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/ftl/fixtures/flank.ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ flank:
test-targets:
- EarlGreyExampleMixedTests/testBasicSelection
testShards: 1
testRuns: 1
repeatTests: 1
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/ftl/fixtures/flank.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ gcloud:

flank:
testShards: 1
testRuns: 1
repeatTests: 1
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/ftl/fixtures/flank2.ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gcloud:

flank:
testShards: 2
testRuns: 1
repeatTests: 1
test-targets:
- EarlGreyExampleMixedTests/testGrantCameraPermission
- EarlGreyExampleMixedTests/testGrantMicrophonePermission
Expand Down
4 changes: 2 additions & 2 deletions test_runner/src/test/kotlin/ftl/run/GenericTestRunnerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import org.mockito.Mockito.mock

class GenericTestRunnerTest {

private fun createMock(testRuns: Int, testShardChunks: List<List<String>>): IArgs {
private fun createMock(repeatTests: Int, testShardChunks: List<List<String>>): IArgs {
val args = mock(IArgs::class.java)
`when`(args.testRuns).thenReturn(testRuns)
`when`(args.repeatTests).thenReturn(repeatTests)
`when`(args.testShardChunks).thenReturn(testShardChunks)
return args
}
Expand Down

0 comments on commit 27cad6d

Please sign in to comment.