Skip to content

Commit 1f9ebc3

Browse files
committed
Adding e2e scripts to enable testing using prow on k8s test infra
1 parent c11f5f9 commit 1f9ebc3

File tree

2 files changed

+133
-0
lines changed

2 files changed

+133
-0
lines changed

e2e/e2e-cloud.sh

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/bin/bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
usage () {
19+
echo "Usage:"
20+
echo " ./e2e/e2e-cloud.sh -h Display this help message."
21+
echo " ./e2e/e2e-cloud.sh -m <master-url> -r <spark-repo> -i <image-repo>"
22+
echo " note that you must have kubectl configured to access the specified"
23+
echo " <master-url>. Also you must have access to the <image-repo>. "
24+
}
25+
26+
### Basic Validation ###
27+
if [ ! -d "integration-test" ]; then
28+
echo "This script must be invoked from the top-level directory of the integration-tests repository"
29+
usage
30+
exit 1
31+
fi
32+
33+
### Set sensible defaults ###
34+
REPO="https://github.com/apache/spark"
35+
IMAGE_REPO="docker.io/kubespark"
36+
37+
### Parse options ###
38+
while getopts m:r:i:h option
39+
do
40+
case "${option}"
41+
in
42+
h)
43+
usage
44+
exit 0
45+
;;
46+
m) MASTER=${OPTARG};;
47+
r) REPO=${OPTARG};;
48+
i) IMAGE_REPO=${OPTARG};;
49+
\? )
50+
echo "Invalid Option: -$OPTARG" 1>&2
51+
exit 1
52+
;;
53+
esac
54+
done
55+
56+
### Ensure cluster is set.
57+
if [ -z "$MASTER" ]
58+
then
59+
echo "Missing master-url (-m) argument."
60+
echo ""
61+
usage
62+
exit
63+
fi
64+
65+
echo "Running tests on cluster $MASTER against $REPO."
66+
echo "Spark images will be created in $IMAGE_REPO"
67+
68+
set -ex
69+
root=$(pwd)
70+
71+
# clone spark distribution if needed.
72+
if [ -d "spark" ];
73+
then
74+
(cd spark && git pull);
75+
else
76+
git clone $REPO;
77+
fi
78+
79+
cd spark && ./dev/make-distribution.sh --tgz -Phadoop-2.7 -Pkubernetes -DskipTests
80+
tag=$(git rev-parse HEAD | cut -c -6)
81+
echo "Spark distribution built at SHA $tag"
82+
83+
cd dist && ./sbin/build-push-docker-images.sh -r $IMAGE_REPO -t $tag build
84+
if [[ $IMAGE_REPO == gcr.io* ]] ;
85+
then
86+
gcloud docker -- push $IMAGE_REPO/spark-driver:$tag && \
87+
gcloud docker -- push $IMAGE_REPO/spark-executor:$tag && \
88+
gcloud docker -- push $IMAGE_REPO/spark-init:$tag
89+
else
90+
./sbin/build-push-docker-images.sh -r $IMAGE_REPO -t $tag push
91+
fi
92+
93+
cd $root/integration-test
94+
$root/spark/build/mvn clean -Ddownload.plugin.skip=true integration-test \
95+
-Dspark-distro-tgz=$root/spark/*.tgz \
96+
-DextraScalaTestArgs="-Dspark.kubernetes.test.master=k8s://$MASTER \
97+
-Dspark.docker.test.driverImage=$IMAGE_REPO/spark-driver:$tag \
98+
-Dspark.docker.test.executorImage=$IMAGE_REPO/spark-executor:$tag" || :
99+
100+
echo "TEST SUITE FINISHED"

e2e/e2e-prow.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
set -ex
19+
20+
# Install basic dependencies
21+
echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list
22+
apt-get update && apt-get install -y curl wget git tar
23+
apt-get install -t jessie-backports -y openjdk-8-jdk
24+
25+
# Set up config.
26+
root=$(pwd)
27+
master=$(kubectl cluster-info | head -n 1 | grep -oE "https?://[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(:[0-9]+)?")
28+
repo="https://github.com/apache/spark"
29+
image_repo="gcr.io/spark-testing-191023"
30+
31+
cd "$(dirname "$0")"/../
32+
./e2e/e2e-cloud.sh -m $master -r $repo -i $image_repo
33+
ls -1 ./integration-test/target/surefire-reports/*.xml | cat -n | while read n f; do cp "$f" "/workspace/_artifacts/junit_0$n.xml"; done

0 commit comments

Comments
 (0)