forked from apache/beam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
199 lines (184 loc) · 7.9 KB
/
build.gradle
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* License); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins { id 'org.apache.beam.module' }
applyGoNature()
applyPythonNature()
description = "Apache Beam :: SDKs :: Go :: Test"
// ValidatesRunner tests for Dataflow. Runs tests in the integration directory
// with Dataflow to validate that the runner behaves as expected.
task dataflowValidatesRunner() {
group = "Verification"
dependsOn ":sdks:go:test:goBuild"
dependsOn ":sdks:java:testing:expansion-service:buildTestExpansionServiceJar"
doLast {
def pipelineOptions = [ // Pipeline options piped directly to Go SDK flags.
"--expansion_jar=test:${project(":sdks:java:testing:expansion-service").buildTestExpansionServiceJar.archivePath}",
]
def options = [
"--runner dataflow",
"--pipeline_opts \"${pipelineOptions.join(' ')}\"",
]
exec {
executable "sh"
args "-c", "./run_validatesrunner_tests.sh ${options.join(' ')}"
}
}
}
// ValidatesRunner tests for Flink. Runs tests in the integration directory
// with Flink to validate that the runner behaves as expected.
task flinkValidatesRunner {
group = "Verification"
dependsOn ":sdks:go:test:goBuild"
dependsOn ":sdks:go:container:docker"
dependsOn ":sdks:java:container:java8:docker"
dependsOn ":runners:flink:${project.ext.latestFlinkVersion}:job-server:shadowJar"
dependsOn ":sdks:java:testing:expansion-service:buildTestExpansionServiceJar"
doLast {
def pipelineOptions = [ // Pipeline options piped directly to Go SDK flags.
"--expansion_jar=test:${project(":sdks:java:testing:expansion-service").buildTestExpansionServiceJar.archivePath}",
]
def options = [
"--runner flink",
"--flink_job_server_jar ${project(":runners:flink:${project.ext.latestFlinkVersion}:job-server").shadowJar.archivePath}",
"--pipeline_opts \"${pipelineOptions.join(' ')}\"",
]
exec {
executable "sh"
args "-c", "./run_validatesrunner_tests.sh ${options.join(' ')}"
}
}
}
// ValidatesRunner tests for Samza. Runs tests in the integration directory
// with Samza to validate that the runner behaves as expected.
task samzaValidatesRunner {
dependsOn ":sdks:go:test:goBuild"
dependsOn ":sdks:go:container:docker"
dependsOn ":sdks:java:container:java8:docker"
dependsOn ":runners:samza:job-server:shadowJar"
dependsOn ":sdks:java:testing:expansion-service:buildTestExpansionServiceJar"
doLast {
def pipelineOptions = [ // Pipeline options piped directly to Go SDK flags.
"--expansion_jar=test:${project(":sdks:java:testing:expansion-service").buildTestExpansionServiceJar.archivePath}",
]
def options = [
"--runner samza",
"--samza_job_server_jar ${project(":runners:samza:job-server").shadowJar.archivePath}",
"--pipeline_opts \"${pipelineOptions.join(' ')}\"",
]
exec {
executable "sh"
args "-c", "./run_validatesrunner_tests.sh ${options.join(' ')}"
}
}
}
// ValidatesRunner tests for Spark. Runs tests in the integration directory
// with Spark to validate that the runner behaves as expected.
task sparkValidatesRunner {
group = "Verification"
dependsOn ":sdks:go:test:goBuild"
dependsOn ":sdks:java:container:java8:docker"
dependsOn ":runners:spark:3:job-server:shadowJar"
dependsOn ":sdks:java:testing:expansion-service:buildTestExpansionServiceJar"
doLast {
def pipelineOptions = [ // Pipeline options piped directly to Go SDK flags.
"--expansion_jar=test:${project(":sdks:java:testing:expansion-service").buildTestExpansionServiceJar.archivePath}",
]
def options = [
"--runner spark",
"--spark_job_server_jar ${project(":runners:spark:3:job-server").shadowJar.archivePath}",
"--pipeline_opts \"${pipelineOptions.join(' ')}\"",
]
exec {
executable "sh"
args "-c", "./run_validatesrunner_tests.sh ${options.join(' ')}"
}
}
}
// ValidatesRunner tests for the Python Portable runner (aka. ULR). Runs tests
// in the integration directory with the ULR to validate that the runner behaves
// as expected.
//
// The ULR can exhibit strange behavior when containers are built with outdated
// vendored directories. For best results use the clean task, like so:
// ./gradlew clean :sdks:go:test:ulrValidatesRunner
tasks.register("ulrValidatesRunner") {
group = "Verification"
dependsOn ":sdks:go:test:goBuild"
dependsOn ":sdks:go:container:docker"
dependsOn ":sdks:java:container:java8:docker"
dependsOn "setupVirtualenv"
dependsOn ":sdks:python:buildPython"
dependsOn ":sdks:java:testing:expansion-service:buildTestExpansionServiceJar"
doLast {
def pipelineOptions = [ // Pipeline options piped directly to Go SDK flags.
"--expansion_jar=test:${project(":sdks:java:testing:expansion-service").buildTestExpansionServiceJar.archivePath}",
]
def options = [
"--runner portable",
"--pipeline_opts \"${pipelineOptions.join(' ')}\"",
]
exec {
executable "sh"
workingDir "${project.rootDir}/sdks/python"
args "-c", ". ${envdir}/bin/activate && pip install -e ."
}
exec {
executable "sh"
args "-c", ". ${envdir}/bin/activate && ./run_validatesrunner_tests.sh ${options.join(' ')}"
}
}
}
// A method for configuring a cross-language validates runner test task,
// intended to be used in calls to createCrossLanguageValidatesRunnerTask.
ext.goIoValidatesRunnerTask = { proj, name, scriptOpts, pipelineOpts ->
return proj.tasks.register(name) {
group = "Verification"
dependsOn ":sdks:go:test:goBuild"
dependsOn ":sdks:go:container:docker"
dependsOn ":sdks:java:io:expansion-service:build"
dependsOn ":sdks:java:extensions:schemaio-expansion-service:build"
dependsOn ":sdks:java:io:debezium:expansion-service:build"
dependsOn ":sdks:java:io:google-cloud-platform:expansion-service:build"
dependsOn ":sdks:java:testing:kafka-service:buildTestKafkaServiceJar"
doLast {
def ioExpJar = project(":sdks:java:io:expansion-service").shadowJar.archivePath
def schemaIoExpJar = project(":sdks:java:extensions:schemaio-expansion-service").shadowJar.archivePath
def debeziumIoExpJar = project(":sdks:java:io:debezium:expansion-service").shadowJar.archivePath
def gcpIoExpJar = project(":sdks:java:io:google-cloud-platform:expansion-service").shadowJar.archivePath
def kafkaJar = project(":sdks:java:testing:kafka-service:").buildTestKafkaServiceJar.archivePath
def pipelineOptions = [ // Pipeline options piped directly to Go SDK flags.
"--kafka_jar=${kafkaJar}",
"--expansion_jar=io:${ioExpJar}",
"--expansion_jar=schemaio:${schemaIoExpJar}",
"--expansion_jar=debeziumio:${debeziumIoExpJar}",
"--expansion_jar=gcpio:${gcpIoExpJar}",
"--bq_dataset=apache-beam-testing.beam_bigquery_io_test_temp",
]
pipelineOptions.addAll(pipelineOpts)
def options = [
"--pipeline_opts \"${pipelineOptions.join(' ')}\"",
]
options.addAll(scriptOpts)
logger.info("Running the command: sh -c ./run_validatesrunner_tests.sh ${options.join(' ')}")
exec {
executable "sh"
args "-c", "./run_validatesrunner_tests.sh ${options.join(' ')}"
}
}
}
}