-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy pathDoctorTest.kt
More file actions
151 lines (137 loc) · 2.75 KB
/
DoctorTest.kt
File metadata and controls
151 lines (137 loc) · 2.75 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package ftl.doctor
import com.google.common.truth.Truth.assertThat
import ftl.args.AndroidArgs
import ftl.args.IArgsCompanion
import ftl.args.IosArgs
import ftl.test.util.FlankTestRunner
import java.nio.file.Paths
import org.junit.Test
import org.junit.runner.RunWith
import java.io.StringReader
@RunWith(FlankTestRunner::class)
class DoctorTest {
@Test
fun androidDoctorTest() {
val lint = Doctor.validateYaml(AndroidArgs, Paths.get("src/test/kotlin/ftl/fixtures/flank.local.yml"))
assertThat(lint).isEmpty()
}
@Test
fun androidDoctorTest2() {
val lint = Doctor.validateYaml(
AndroidArgs, """
hi: .
foo:
bar: 1
gcloud:
results-bucket: .
record-video: .
timeout: .
async: .
results-history-name: .
app: .
test: .
auto-google-login: .
use-orchestrator: .
environment-variables:
clearPackageData: .
directories-to-pull:
- .
performance-metrics: .
test-targets:
- .
device:
- model: .
version: .
locale: .
orientation: .
two: .
flank:
max-test-shards: 7
num-test-runs: 8
test-targets-always-run:
- .
three: .
project: .
""".trimIndent()
)
assertThat(lint).isEqualTo(
"""
Unknown top level keys: [hi, foo]
Unknown keys in gcloud -> [two]
Unknown keys in flank -> [three]
""".trimIndent()
)
}
@Test
fun androidDoctorTest3() {
val lint = Doctor.validateYaml(
AndroidArgs, """
gcloud:
app: .
test: .
flank:
project: .
""".trimIndent()
)
assertThat(lint).isEqualTo("")
}
@Test
fun iosDoctorTest() {
val lint = Doctor.validateYaml(IosArgs, Paths.get("src/test/kotlin/ftl/fixtures/flank.ios.yml"))
assertThat(lint).isEmpty()
}
@Test
fun iosDoctorTest2() {
val lint = Doctor.validateYaml(
IosArgs, """
hi: .
foo:
bar: 1
gcloud:
results-bucket: .
record-video: .
timeout: .
async: .
results-history-name: .
test: .
xctestrun-file: .
device:
- model: .
version: .
locale: .
orientation: .
two: .
flank:
max-test-shards: .
num-test-runs: .
test-targets-always-run:
- .
test-targets:
- .
three: .
project: .
""".trimIndent()
)
assertThat(lint).isEqualTo(
"""
Unknown top level keys: [hi, foo]
Unknown keys in gcloud -> [two]
Unknown keys in flank -> [three]
""".trimIndent()
)
}
@Test
fun iosDoctorTest3() {
val lint = Doctor.validateYaml(
IosArgs, """
gcloud:
test: .
xctestrun-file: .
flank:
project: .
""".trimIndent()
)
assertThat(lint).isEqualTo("")
}
}
private fun Doctor.validateYaml(args: IArgsCompanion, data: String): String = validateYaml(args, StringReader(data))