-
-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathValidateExclusionsTest.kt
More file actions
78 lines (69 loc) · 2.25 KB
/
ValidateExclusionsTest.kt
File metadata and controls
78 lines (69 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.osacky.flank.gradle.validation
import com.google.common.truth.Truth.assertThat
import com.osacky.flank.gradle.integration.gradleRunner
import com.osacky.flank.gradle.integration.writeBuildDotGradle
import com.osacky.flank.gradle.integration.writeEmptyServiceCredential
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
class ValidateExclusionsTest {
@get:Rule
var testProjectRoot = TemporaryFolder()
@Test
fun `should throw an error when mutually exclusive options used`() {
testProjectRoot.writeBuildDotGradle(
"""
|plugins {
| id "com.osacky.fladle"
|}
|
|fladle {
| serviceAccountCredentials = layout.projectDirectory.file("flank-gradle-service.json")
| debugApk = "foo.apk"
| instrumentationApk = "test.apk"
| testShards.set(1)
| maxTestShards.set(2)
| flankVersion.set("23.01.0")
|}
""".trimMargin(),
)
val result =
testProjectRoot.gradleRunner()
.withArguments("printYml")
.buildAndFail()
assertThat(result.output).contains("FAILED")
assertThat(result.output).contains("Options testShards and maxTestShards cannot be used together. Choose one of them.")
}
@Test
fun `should throw an error when mutually exclusive options used -- inner config`() {
testProjectRoot.writeBuildDotGradle(
"""
|plugins {
| id "com.osacky.fladle"
|}
|
|fladle {
| serviceAccountCredentials = layout.projectDirectory.file("flank-gradle-service.json")
| debugApk = "foo.apk"
| instrumentationApk = "test.apk"
| testShards.set(1)
| flankVersion.set("21.01.0")
| configs {
| newSharding {
| maxTestShards.set(2)
| }
| }
|}
""".trimMargin(),
)
testProjectRoot.writeEmptyServiceCredential()
val runner = testProjectRoot.gradleRunner()
runner.withArguments("printYml").build().run {
assertThat(output).contains("SUCCESS")
}
runner.withArguments("printYmlNewSharding").buildAndFail().run {
assertThat(output).contains("FAILED")
assertThat(output).contains("Options testShards and maxTestShards cannot be used together. Choose one of them.")
}
}
}