44set -o pipefail
55
66if ! cat /etc/* release | grep -q stretch; then
7- echo ${BASH_SOURCE} only supports Debian stretch.
7+ echo ${BASH_SOURCE} only supports Debian stretch.
88 echo Please change your operating system to use this script.
99 exit 1
1010fi
1111
12+ test -z ${GOOGLE_APPLICATION_CREDENTIALS} && GOOGLE_APPLICATION_CREDENTIALS=" /etc/service-account/service-account.json"
13+ test -z ${SKIP_BUILD_JARS} && SKIP_BUILD_JARS=" false"
14+ test -z ${GOOGLE_CLOUD_PROJECT} && GOOGLE_CLOUD_PROJECT=" kf-feast"
15+ test -z ${TEMP_BUCKET} && TEMP_BUCKET=" feast-templocation-kf-feast"
16+ test -z ${JOBS_STAGING_LOCATION} && JOBS_STAGING_LOCATION=" gs://${TEMP_BUCKET} /staging-location"
17+ test -z ${JAR_VERSION_SUFFIX} && JAR_VERSION_SUFFIX=" -SNAPSHOT"
18+
1219echo "
1320This script will run end-to-end tests for Feast Core and Batch Serving.
1421
15221. Install gcloud SDK
16232. Install Redis as the job store for Feast Batch Serving.
17244. Install Postgres for persisting Feast metadata.
18255. Install Kafka and Zookeeper as the Source in Feast.
19- 6. Install Python 3.7.4, Feast Python SDK and run end-to-end tests from
26+ 6. Install Python 3.7.4, Feast Python SDK and run end-to-end tests from
2027 tests/e2e via pytest.
2128"
2229
30+ apt-get -qq update
31+ apt-get -y install wget netcat kafkacat
32+
2333
2434echo "
2535============================================================
@@ -31,8 +41,8 @@ if [[ ! $(command -v gsutil) ]]; then
3141 . " ${CURRENT_DIR} " /install-google-cloud-sdk.sh
3242fi
3343
34- export GOOGLE_APPLICATION_CREDENTIALS=/etc/service-account/service-account.json
35- gcloud auth activate-service-account --key-file /etc/service-account/service-account.json
44+ export GOOGLE_APPLICATION_CREDENTIALS
45+ gcloud auth activate-service-account --key-file ${GOOGLE_APPLICATION_CREDENTIALS}
3646
3747
3848
@@ -41,10 +51,9 @@ echo "
4151Installing Redis at localhost:6379
4252============================================================
4353"
44- apt-get -qq update
4554# Allow starting serving in this Maven Docker image. Default set to not allowed.
4655echo " exit 0" > /usr/sbin/policy-rc.d
47- apt-get -y install redis-server wget > /var/log/redis.install.log
56+ apt-get -y install redis-server > /var/log/redis.install.log
4857redis-server --daemonize yes
4958redis-cli ping
5059
@@ -73,24 +82,32 @@ Installing Kafka at localhost:9092
7382wget -qO- https://www-eu.apache.org/dist/kafka/2.3.0/kafka_2.12-2.3.0.tgz | tar xz
7483mv kafka_2.12-2.3.0/ /tmp/kafka
7584nohup /tmp/kafka/bin/zookeeper-server-start.sh /tmp/kafka/config/zookeeper.properties & > /var/log/zookeeper.log 2>&1 &
76- sleep 10
85+ sleep 5
7786tail -n10 /var/log/zookeeper.log
7887nohup /tmp/kafka/bin/kafka-server-start.sh /tmp/kafka/config/server.properties & > /var/log/kafka.log 2>&1 &
79- sleep 30
88+ sleep 20
8089tail -n10 /var/log/kafka.log
81-
82- echo "
83- ============================================================
84- Building jars for Feast
85- ============================================================
86- "
87-
88- .prow/scripts/download-maven-cache.sh \
89- --archive-uri gs://feast-templocation-kf-feast/.m2.2019-10-24.tar \
90- --output-dir /root/
91-
92- # Build jars for Feast
93- mvn --quiet --batch-mode --define skipTests=true clean package
90+ kafkacat -b localhost:9092 -L
91+
92+ if [[ ${SKIP_BUILD_JARS} != " true" ]]; then
93+ echo "
94+ ============================================================
95+ Building jars for Feast
96+ ============================================================
97+ "
98+
99+ .prow/scripts/download-maven-cache.sh \
100+ --archive-uri gs://feast-templocation-kf-feast/.m2.2019-10-24.tar \
101+ --output-dir /root/
102+
103+ # Build jars for Feast
104+ mvn --quiet --batch-mode --define skipTests=true clean package
105+
106+ ls -lh core/target/* jar
107+ ls -lh serving/target/* jar
108+ else
109+ echo " [DEBUG] Skipping building jars"
110+ fi
94111
95112echo "
96113============================================================
@@ -142,11 +159,13 @@ management:
142159 enabled: false
143160EOF
144161
145- nohup java -jar core/target/feast-core-* -SNAPSHOT .jar \
162+ nohup java -jar core/target/feast-core-* ${JAR_VERSION_SUFFIX} .jar \
146163 --spring.config.location=file:///tmp/core.application.yml \
147164 & > /var/log/feast-core.log &
148165sleep 35
149166tail -n10 /var/log/feast-core.log
167+ nc -w2 localhost 6565 < /dev/null
168+
150169echo "
151170============================================================
152171Starting Feast Warehouse Serving
@@ -155,18 +174,18 @@ Starting Feast Warehouse Serving
155174
156175DATASET_NAME=feast_$( date +%s)
157176
158- bq --location=US --project_id=kf-feast mk \
177+ bq --location=US --project_id=${GOOGLE_CLOUD_PROJECT} mk \
159178 --dataset \
160179 --default_table_expiration 86400 \
161- kf-feast: $ DATASET_NAME
180+ ${GOOGLE_CLOUD_PROJECT} : ${ DATASET_NAME}
162181
163182# Start Feast Online Serving in background
164183cat << EOF > /tmp/serving.store.bigquery.yml
165184name: warehouse
166185type: BIGQUERY
167186bigquery_config:
168- projectId: kf-feast
169- datasetId: $DATASET_NAME
187+ projectId: ${GOOGLE_CLOUD_PROJECT}
188+ datasetId: ${ DATASET_NAME}
170189subscriptions:
171190 - name: "*"
172191 version: "*"
@@ -183,24 +202,27 @@ feast:
183202 store:
184203 config-path: /tmp/serving.store.bigquery.yml
185204 jobs:
186- staging-location: gs://feast-templocation-kf-feast/staging-location
205+ staging-location: ${JOBS_STAGING_LOCATION}
187206 store-type: REDIS
188207 store-options:
189- host: $REMOTE_HOST
208+ host: localhost
190209 port: 6379
191210grpc:
192211 port: 6566
193212 enable-reflection: true
213+
194214spring:
195215 main:
196216 web-environment: false
217+
197218EOF
198219
199- nohup java -jar serving/target/feast-serving-* -SNAPSHOT .jar \
220+ nohup java -jar serving/target/feast-serving-* ${JAR_VERSION_SUFFIX} .jar \
200221 --spring.config.location=file:///tmp/serving.warehouse.application.yml \
201222 & > /var/log/feast-serving-warehouse.log &
202223sleep 15
203224tail -n100 /var/log/feast-serving-warehouse.log
225+ nc -w2 localhost 6566 < /dev/null
204226
205227echo "
206228============================================================
@@ -230,9 +252,15 @@ ORIGINAL_DIR=$(pwd)
230252cd tests/e2e
231253
232254set +e
233- pytest bq-batch-retrieval.py --junitxml=${LOGS_ARTIFACT_PATH} /python-sdk-test-report.xml
255+ pytest bq-batch-retrieval.py --gcs_path " gs:// ${TEMP_BUCKET} / " -- junitxml=${LOGS_ARTIFACT_PATH} /python-sdk-test-report.xml
234256TEST_EXIT_CODE=$?
235257
258+ if [[ ${TEST_EXIT_CODE} != 0 ]]; then
259+ echo " [DEBUG] Printing logs"
260+ ls -ltrh /var/log/feast*
261+ cat /var/log/feast-serving-warehouse.log /var/log/feast-core.log
262+ fi
263+
236264cd ${ORIGINAL_DIR}
237265exit ${TEST_EXIT_CODE}
238266
@@ -242,4 +270,4 @@ Cleaning up
242270============================================================
243271"
244272
245- bq rm -r -f kf-feast: $ DATASET_NAME
273+ bq rm -r -f ${GOOGLE_CLOUD_PROJECT} : ${ DATASET_NAME}
0 commit comments