@@ -24,9 +24,13 @@ test -z ${TEMP_BUCKET} && TEMP_BUCKET="feast-templocation-kf-feast"
2424test -z ${JOBS_STAGING_LOCATION} && JOBS_STAGING_LOCATION=" gs://${TEMP_BUCKET} /staging-location"
2525
2626# Get the current build version using maven (and pom.xml)
27- FEAST_BUILD_VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
27+ export FEAST_BUILD_VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
2828echo Building version: $FEAST_BUILD_VERSION
2929
30+ # Get Feast project repository root and scripts directory
31+ export PROJECT_ROOT_DIR=$( git rev-parse --show-toplevel)
32+ export SCRIPTS_DIR=${PROJECT_ROOT_DIR} /infra/scripts
33+
3034echo "
3135This script will run end-to-end tests for Feast Core and Batch Serving.
3236
@@ -38,152 +42,24 @@ This script will run end-to-end tests for Feast Core and Batch Serving.
3842 tests/e2e via pytest.
3943"
4044
41- apt-get -qq update
42- apt-get -y install wget netcat kafkacat build-essential
43-
44-
45- echo "
46- ============================================================
47- Installing gcloud SDK
48- ============================================================
49- "
50- if [[ ! $( command -v gsutil) ]]; then
51- CURRENT_DIR=$( dirname " $BASH_SOURCE " )
52- . " ${CURRENT_DIR} " /install-google-cloud-sdk.sh
53- fi
54-
55- export GOOGLE_APPLICATION_CREDENTIALS
56- gcloud auth activate-service-account --key-file ${GOOGLE_APPLICATION_CREDENTIALS}
57-
58-
59-
60- echo "
61- ============================================================
62- Installing Redis at localhost:6379
63- ============================================================
64- "
65- # Allow starting serving in this Maven Docker image. Default set to not allowed.
66- echo " exit 0" > /usr/sbin/policy-rc.d
67- apt-get -y install redis-server > /var/log/redis.install.log
68- redis-server --daemonize yes
69- redis-cli ping
70-
71- echo "
72- ============================================================
73- Installing Postgres at localhost:5432
74- ============================================================
75- "
76- apt-get -y install postgresql > /var/log/postgresql.install.log
77- service postgresql start
78- # Initialize with database: 'postgres', user: 'postgres', password: 'password'
79- cat << EOF > /tmp/update-postgres-role.sh
80- psql -c "ALTER USER postgres PASSWORD 'password';"
81- EOF
82- chmod +x /tmp/update-postgres-role.sh
83- su -s /bin/bash -c /tmp/update-postgres-role.sh postgres
84- export PGPASSWORD=password
85- pg_isready
45+ source ${SCRIPTS_DIR} /setup-common-functions.sh
8646
87- echo "
88- ============================================================
89- Installing Zookeeper at localhost:2181
90- Installing Kafka at localhost:9092
91- ============================================================
92- "
93- wget -qO- https://www-eu.apache.org/dist/kafka/2.3.0/kafka_2.12-2.3.0.tgz | tar xz
94- mv kafka_2.12-2.3.0/ /tmp/kafka
95- nohup /tmp/kafka/bin/zookeeper-server-start.sh /tmp/kafka/config/zookeeper.properties & > /var/log/zookeeper.log 2>&1 &
96- sleep 5
97- tail -n10 /var/log/zookeeper.log
98- nohup /tmp/kafka/bin/kafka-server-start.sh /tmp/kafka/config/server.properties & > /var/log/kafka.log 2>&1 &
99- sleep 20
100- tail -n10 /var/log/kafka.log
101- kafkacat -b localhost:9092 -L
47+ install_test_tools
48+ install_gcloud_sdk
49+ install_and_start_local_redis
50+ install_and_start_local_postgres
51+ install_and_start_local_zookeeper_and_kafka
10252
10353if [[ ${SKIP_BUILD_JARS} != " true" ]]; then
104- echo "
105- ============================================================
106- Building jars for Feast
107- ============================================================
108- "
109-
110- infra/scripts/download-maven-cache.sh \
111- --archive-uri gs://feast-templocation-kf-feast/.m2.2019-10-24.tar \
112- --output-dir /root/
113-
114- # Build jars for Feast
115- mvn --quiet --batch-mode --define skipTests=true clean package
116-
117- ls -lh core/target/* jar
118- ls -lh serving/target/* jar
54+ build_feast_core_and_serving
11955else
12056 echo " [DEBUG] Skipping building jars"
12157fi
12258
123- echo "
124- ============================================================
125- Starting Feast Core
126- ============================================================
127- "
128- # Start Feast Core in background
129- cat << EOF > /tmp/core.application.yml
130- grpc:
131- port: 6565
132- enable-reflection: true
133-
134- feast:
135- jobs:
136- polling_interval_milliseconds: 10000
137- job_update_timeout_seconds: 240
138-
139- active_runner: direct
140-
141- runners:
142- - name: direct
143- type: DirectRunner
144- options: {}
145-
146- metrics:
147- enabled: false
148-
149- stream:
150- type: kafka
151- options:
152- topic: feast-features
153- bootstrapServers: localhost:9092
154- replicationFactor: 1
155- partitions: 1
156-
157- spring:
158- jpa:
159- properties.hibernate:
160- format_sql: true
161- event:
162- merge:
163- entity_copy_observer: allow
164- hibernate.naming.physical-strategy=org.hibernate.boot.model.naming: PhysicalNamingStrategyStandardImpl
165- hibernate.ddl-auto: update
166- datasource:
167- url: jdbc:postgresql://localhost:5432/postgres
168- username: postgres
169- password: password
170- EOF
171-
172- nohup java -jar core/target/feast-core-${FEAST_BUILD_VERSION} .jar \
173- --spring.config.location=file:///tmp/core.application.yml \
174- & > /var/log/feast-core.log &
175- sleep 35
176- tail -n10 /var/log/feast-core.log
177- nc -w2 localhost 6565 < /dev/null
178-
179- echo "
180- ============================================================
181- Starting Feast Warehouse Serving
182- ============================================================
183- "
59+ export FEAST_JOBS_POLLING_INTERVAL_MILLISECONDS=10000
60+ start_feast_core
18461
18562DATASET_NAME=feast_$( date +%s)
186-
18763bq --location=US --project_id=${GOOGLE_CLOUD_PROJECT} mk \
18864 --dataset \
18965 --default_table_expiration 86400 \
@@ -232,35 +108,11 @@ server:
232108
233109EOF
234110
235- nohup java -jar serving/target/feast-serving-${FEAST_BUILD_VERSION} .jar \
236- --spring.config.location=file:///tmp/serving.warehouse.application.yml \
237- & > /var/log/feast-serving-warehouse.log &
238- sleep 15
239- tail -n100 /var/log/feast-serving-warehouse.log
240- nc -w2 localhost 6566 < /dev/null
111+ start_feast_serving /tmp/serving.warehouse.application.yml
241112
242- echo "
243- ============================================================
244- Installing Python 3.7 with Miniconda and Feast SDK
245- ============================================================
246- "
247- # Install Python 3.7 with Miniconda
248- wget -q https://repo.continuum.io/miniconda/Miniconda3-4.7.12-Linux-x86_64.sh \
249- -O /tmp/miniconda.sh
250- bash /tmp/miniconda.sh -b -p /root/miniconda -f
251- /root/miniconda/bin/conda init
252- source ~ /.bashrc
253-
254- # Install Feast Python SDK and test requirements
255- make compile-protos-python
256- pip install -qe sdk/python
257- pip install -qr tests/e2e/requirements.txt
113+ install_python_with_miniconda_and_feast_sdk
258114
259- echo "
260- ============================================================
261- Running end-to-end tests with pytest at 'tests/e2e'
262- ============================================================
263- "
115+ print_banner " Running end-to-end tests with pytest at 'tests/e2e'"
264116# Default artifact location setting in Prow jobs
265117LOGS_ARTIFACT_PATH=/logs/artifacts
266118
282134
283135cd ${ORIGINAL_DIR}
284136
285- echo "
286- ============================================================
287- Cleaning up
288- ============================================================
289- "
137+ print_banner " Cleaning up"
290138
291139bq rm -r -f ${GOOGLE_CLOUD_PROJECT} :${DATASET_NAME}
292-
293140exit ${TEST_EXIT_CODE}
0 commit comments