Skip to content

Commit fc0c8c9

Browse files
committed
[SPARK-24825][K8S][TEST] Kubernetes integration tests build the whole reactor
## What changes were proposed in this pull request? Make the integration test script build all modules. In order to not run all the non-Kubernetes integration tests in the build, support specifying tags and tag all integration tests specifically with "k8s". Supply the k8s tag in the dev/dev-run-integration-tests.sh script. ## How was this patch tested? The build system will test this. Author: mcheah <[email protected]> Closes #21800 from mccheah/k8s-integration-tests-maven-fix.
1 parent ebe9e28 commit fc0c8c9

File tree

3 files changed

+23
-26
lines changed

3 files changed

+23
-26
lines changed

pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194

195195
<test.java.home>${java.home}</test.java.home>
196196
<test.exclude.tags></test.exclude.tags>
197+
<test.include.tags></test.include.tags>
197198

198199
<!-- Package to use when relocating shaded classes. -->
199200
<spark.shade.packageName>org.spark_project</spark.shade.packageName>
@@ -2162,6 +2163,7 @@
21622163
</systemProperties>
21632164
<failIfNoTests>false</failIfNoTests>
21642165
<excludedGroups>${test.exclude.tags}</excludedGroups>
2166+
<groups>${test.include.tags}</groups>
21652167
</configuration>
21662168
<executions>
21672169
<execution>
@@ -2209,6 +2211,7 @@
22092211
<test.src.tables>__not_used__</test.src.tables>
22102212
</systemProperties>
22112213
<tagsToExclude>${test.exclude.tags}</tagsToExclude>
2214+
<tagsToInclude>${test.include.tags}</tagsToInclude>
22122215
</configuration>
22132216
<executions>
22142217
<execution>

resource-managers/kubernetes/integration-tests/dev/dev-run-integration-tests.sh

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818
#
19-
TEST_ROOT_DIR=$(git rev-parse --show-toplevel)/resource-managers/kubernetes/integration-tests
20-
21-
cd "${TEST_ROOT_DIR}"
19+
set -xo errexit
20+
TEST_ROOT_DIR=$(git rev-parse --show-toplevel)
2221

2322
DEPLOY_MODE="minikube"
2423
IMAGE_REPO="docker.io/kubespark"
@@ -27,7 +26,7 @@ IMAGE_TAG="N/A"
2726
SPARK_MASTER=
2827
NAMESPACE=
2928
SERVICE_ACCOUNT=
30-
INCLUDE_TAGS=
29+
INCLUDE_TAGS="k8s"
3130
EXCLUDE_TAGS=
3231

3332
# Parse arguments
@@ -62,7 +61,7 @@ while (( "$#" )); do
6261
shift
6362
;;
6463
--include-tags)
65-
INCLUDE_TAGS="$2"
64+
INCLUDE_TAGS="k8s,$2"
6665
shift
6766
;;
6867
--exclude-tags)
@@ -76,13 +75,12 @@ while (( "$#" )); do
7675
shift
7776
done
7877

79-
cd $TEST_ROOT_DIR
80-
8178
properties=(
8279
-Dspark.kubernetes.test.sparkTgz=$SPARK_TGZ \
8380
-Dspark.kubernetes.test.imageTag=$IMAGE_TAG \
8481
-Dspark.kubernetes.test.imageRepo=$IMAGE_REPO \
85-
-Dspark.kubernetes.test.deployMode=$DEPLOY_MODE
82+
-Dspark.kubernetes.test.deployMode=$DEPLOY_MODE \
83+
-Dtest.include.tags=$INCLUDE_TAGS
8684
)
8785

8886
if [ -n $NAMESPACE ];
@@ -105,9 +103,4 @@ then
105103
properties=( ${properties[@]} -Dtest.exclude.tags=$EXCLUDE_TAGS )
106104
fi
107105

108-
if [ -n $INCLUDE_TAGS ];
109-
then
110-
properties=( ${properties[@]} -Dtest.include.tags=$INCLUDE_TAGS )
111-
fi
112-
113-
../../../build/mvn integration-test ${properties[@]}
106+
$TEST_ROOT_DIR/build/mvn integration-test -f $TEST_ROOT_DIR/pom.xml -pl resource-managers/kubernetes/integration-tests -am -Pkubernetes -Phadoop-2.7 ${properties[@]}

resource-managers/kubernetes/integration-tests/src/test/scala/org/apache/spark/deploy/k8s/integrationtest/KubernetesSuite.scala

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import java.util.regex.Pattern
2323

2424
import com.google.common.io.PatternFilenameFilter
2525
import io.fabric8.kubernetes.api.model.Pod
26-
import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll}
26+
import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll, Tag}
2727
import org.scalatest.concurrent.{Eventually, PatienceConfiguration}
2828
import org.scalatest.time.{Minutes, Seconds, Span}
2929
import scala.collection.JavaConverters._
@@ -47,6 +47,7 @@ private[spark] class KubernetesSuite extends SparkFunSuite
4747
private var containerLocalSparkDistroExamplesJar: String = _
4848
private var appLocator: String = _
4949
private var driverPodName: String = _
50+
private val k8sTestTag = Tag("k8s")
5051

5152
override def beforeAll(): Unit = {
5253
// The scalatest-maven-plugin gives system properties that are referenced but not set null
@@ -102,22 +103,22 @@ private[spark] class KubernetesSuite extends SparkFunSuite
102103
deleteDriverPod()
103104
}
104105

105-
test("Run SparkPi with no resources") {
106+
test("Run SparkPi with no resources", k8sTestTag) {
106107
runSparkPiAndVerifyCompletion()
107108
}
108109

109-
test("Run SparkPi with a very long application name.") {
110+
test("Run SparkPi with a very long application name.", k8sTestTag) {
110111
sparkAppConf.set("spark.app.name", "long" * 40)
111112
runSparkPiAndVerifyCompletion()
112113
}
113114

114-
test("Use SparkLauncher.NO_RESOURCE") {
115+
test("Use SparkLauncher.NO_RESOURCE", k8sTestTag) {
115116
sparkAppConf.setJars(Seq(containerLocalSparkDistroExamplesJar))
116117
runSparkPiAndVerifyCompletion(
117118
appResource = SparkLauncher.NO_RESOURCE)
118119
}
119120

120-
test("Run SparkPi with a master URL without a scheme.") {
121+
test("Run SparkPi with a master URL without a scheme.", k8sTestTag) {
121122
val url = kubernetesTestComponents.kubernetesClient.getMasterUrl
122123
val k8sMasterUrl = if (url.getPort < 0) {
123124
s"k8s://${url.getHost}"
@@ -128,11 +129,11 @@ private[spark] class KubernetesSuite extends SparkFunSuite
128129
runSparkPiAndVerifyCompletion()
129130
}
130131

131-
test("Run SparkPi with an argument.") {
132+
test("Run SparkPi with an argument.", k8sTestTag) {
132133
runSparkPiAndVerifyCompletion(appArgs = Array("5"))
133134
}
134135

135-
test("Run SparkPi with custom labels, annotations, and environment variables.") {
136+
test("Run SparkPi with custom labels, annotations, and environment variables.", k8sTestTag) {
136137
sparkAppConf
137138
.set("spark.kubernetes.driver.label.label1", "label1-value")
138139
.set("spark.kubernetes.driver.label.label2", "label2-value")
@@ -158,21 +159,21 @@ private[spark] class KubernetesSuite extends SparkFunSuite
158159
})
159160
}
160161

161-
test("Run extraJVMOptions check on driver") {
162+
test("Run extraJVMOptions check on driver", k8sTestTag) {
162163
sparkAppConf
163164
.set("spark.driver.extraJavaOptions", "-Dspark.test.foo=spark.test.bar")
164165
runSparkJVMCheckAndVerifyCompletion(
165166
expectedJVMValue = Seq("(spark.test.foo,spark.test.bar)"))
166167
}
167168

168-
test("Run SparkRemoteFileTest using a remote data file") {
169+
test("Run SparkRemoteFileTest using a remote data file", k8sTestTag) {
169170
sparkAppConf
170171
.set("spark.files", REMOTE_PAGE_RANK_DATA_FILE)
171172
runSparkRemoteCheckAndVerifyCompletion(
172173
appArgs = Array(REMOTE_PAGE_RANK_FILE_NAME))
173174
}
174175

175-
test("Run PySpark on simple pi.py example") {
176+
test("Run PySpark on simple pi.py example", k8sTestTag) {
176177
sparkAppConf
177178
.set("spark.kubernetes.container.image", s"${getTestImageRepo}/spark-py:${getTestImageTag}")
178179
runSparkApplicationAndVerifyCompletion(
@@ -186,7 +187,7 @@ private[spark] class KubernetesSuite extends SparkFunSuite
186187
isJVM = false)
187188
}
188189

189-
test("Run PySpark with Python2 to test a pyfiles example") {
190+
test("Run PySpark with Python2 to test a pyfiles example", k8sTestTag) {
190191
sparkAppConf
191192
.set("spark.kubernetes.container.image", s"${getTestImageRepo}/spark-py:${getTestImageTag}")
192193
.set("spark.kubernetes.pyspark.pythonversion", "2")
@@ -204,7 +205,7 @@ private[spark] class KubernetesSuite extends SparkFunSuite
204205
pyFiles = Some(PYSPARK_CONTAINER_TESTS))
205206
}
206207

207-
test("Run PySpark with Python3 to test a pyfiles example") {
208+
test("Run PySpark with Python3 to test a pyfiles example", k8sTestTag) {
208209
sparkAppConf
209210
.set("spark.kubernetes.container.image", s"${getTestImageRepo}/spark-py:${getTestImageTag}")
210211
.set("spark.kubernetes.pyspark.pythonversion", "3")

0 commit comments

Comments
 (0)