Skip to content

Commit ec0d65f

Browse files
authored
Refactored end-to-end tests fully orchestrated by pytest (#1094)
1 parent 9e9f1a7 commit ec0d65f

33 files changed

+675
-929
lines changed

.github/workflows/complete.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,54 @@ jobs:
156156
- name: copy to gs
157157
run: gsutil cp ./spark/ingestion/target/feast-ingestion-spark-${GITHUB_SHA}.jar gs://feast-jobs/spark/ingestion/
158158

159+
test-end-to-end:
160+
runs-on: [self-hosted]
161+
steps:
162+
- uses: actions/checkout@v2
163+
- uses: actions/setup-java@v1
164+
with:
165+
java-version: '11'
166+
- uses: stCarolas/setup-maven@v3
167+
with:
168+
maven-version: 3.6.3
169+
- uses: actions/setup-python@v2
170+
with:
171+
python-version: 3.6
172+
- name: install
173+
run: |
174+
apt-get update && apt-get install -y redis-server postgresql libpq-dev
175+
make build-java-no-tests REVISION=develop
176+
python -m pip install --upgrade pip setuptools wheel
177+
make install-python
178+
python -m pip install -qr tests/requirements.txt
179+
- name: run tests
180+
run: su -p postgres -c "PATH=$PATH HOME=/tmp pytest tests/e2e/ --feast-version develop"
181+
182+
test-end-to-end-gcp:
183+
runs-on: [self-hosted]
184+
env:
185+
DISABLE_SERVICE_FIXTURES: true
186+
steps:
187+
- uses: actions/checkout@v2
188+
- uses: actions/setup-java@v1
189+
with:
190+
java-version: '11'
191+
- uses: stCarolas/setup-maven@v3
192+
with:
193+
maven-version: 3.6.3
194+
- uses: actions/setup-python@v2
195+
with:
196+
python-version: 3.6
197+
- name: install
198+
run: |
199+
apt-get update && apt-get install -y redis-server postgresql libpq-dev
200+
make build-java-no-tests REVISION=develop
201+
python -m pip install --upgrade pip setuptools wheel
202+
make install-python
203+
python -m pip install -qr tests/requirements.txt
204+
- name: run tests
205+
run: >
206+
su -p postgres -c "PATH=$PATH HOME=/tmp pytest tests/e2e/
207+
--feast-version develop --env=gcloud --dataproc-cluster-name feast-e2e
208+
--dataproc-project kf-feast --dataproc-region us-central1
209+
--redis-url 10.128.0.105:6379 --redis-cluster --kafka-brokers 10.128.0.103:9094"

.prow/config.yaml

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -141,118 +141,6 @@ presubmits:
141141
- image: golang:1.13
142142
command: ["infra/scripts/test-golang-sdk.sh"]
143143

144-
- name: test-end-to-end
145-
decorate: true
146-
always_run: true
147-
spec:
148-
containers:
149-
- image: maven:3.6-jdk-11
150-
command: ["infra/scripts/test-end-to-end.sh"]
151-
resources:
152-
requests:
153-
cpu: "6"
154-
memory: "6144Mi"
155-
env:
156-
- name: GOOGLE_APPLICATION_CREDENTIALS
157-
value: /etc/gcloud/service-account.json
158-
volumeMounts:
159-
- mountPath: /etc/gcloud/service-account.json
160-
name: service-account
161-
readOnly: true
162-
subPath: service-account.json
163-
volumes:
164-
- name: service-account
165-
secret:
166-
secretName: feast-service-account
167-
skip_branches:
168-
- ^v0\.(3|4)-branch$
169-
170-
- name: test-end-to-end-auth
171-
decorate: true
172-
always_run: true
173-
spec:
174-
containers:
175-
- image: maven:3.6-jdk-11
176-
command: ["infra/scripts/test-end-to-end.sh", "True"]
177-
resources:
178-
requests:
179-
cpu: "6"
180-
memory: "6144Mi"
181-
env:
182-
- name: GOOGLE_APPLICATION_CREDENTIALS
183-
value: /etc/gcloud/service-account.json
184-
volumeMounts:
185-
- mountPath: /etc/gcloud/service-account.json
186-
name: service-account
187-
readOnly: true
188-
subPath: service-account.json
189-
volumes:
190-
- name: service-account
191-
secret:
192-
secretName: feast-service-account
193-
skip_branches:
194-
- ^v0\.(3|4)-branch$
195-
196-
- name: test-end-to-end-redis-cluster
197-
decorate: true
198-
always_run: true
199-
spec:
200-
containers:
201-
- image: maven:3.6-jdk-11
202-
command: ["infra/scripts/test-end-to-end-redis-cluster.sh"]
203-
resources:
204-
requests:
205-
cpu: "6"
206-
memory: "6144Mi"
207-
env:
208-
- name: GOOGLE_APPLICATION_CREDENTIALS
209-
value: /etc/gcloud/service-account.json
210-
volumeMounts:
211-
- mountPath: /etc/gcloud/service-account.json
212-
name: service-account
213-
readOnly: true
214-
subPath: service-account.json
215-
volumes:
216-
- name: service-account
217-
secret:
218-
secretName: feast-service-account
219-
skip_branches:
220-
- ^v0\.(3|4)-branch$
221-
222-
- name: test-end-to-end-java-8
223-
decorate: true
224-
always_run: true
225-
spec:
226-
containers:
227-
- image: maven:3.6-jdk-8
228-
command: ["infra/scripts/test-end-to-end.sh"]
229-
resources:
230-
requests:
231-
cpu: "6"
232-
memory: "6144Mi"
233-
branches:
234-
- ^v0\.(3|4)-branch$
235-
236-
- name: test-end-to-end-batch-java-8
237-
decorate: true
238-
always_run: true
239-
spec:
240-
volumes:
241-
- name: service-account
242-
secret:
243-
secretName: feast-service-account
244-
containers:
245-
- image: maven:3.6-jdk-8
246-
command: ["infra/scripts/test-end-to-end-batch.sh"]
247-
resources:
248-
requests:
249-
cpu: "6"
250-
memory: "6144Mi"
251-
volumeMounts:
252-
- name: service-account
253-
mountPath: "/etc/service-account"
254-
branches:
255-
- ^v0\.(3|4)-branch$
256144

257145
postsubmits:
258146
feast-dev/feast:

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ compile-protos-python: install-python-ci-dependencies
7070
cd ${ROOT_DIR}/protos; python -m grpc_tools.protoc -I. --python_out=../sdk/python/ --grpc_python_out=../sdk/python/ --mypy_out=../sdk/python/ feast/third_party/grpc/health/v1/*.proto
7171

7272
install-python: compile-protos-python
73-
cd sdk/python; python setup.py develop
73+
python -m pip install -e sdk/python
7474

7575
test-python:
7676
pytest --verbose --color=yes sdk/python/tests
@@ -90,10 +90,10 @@ lint-python:
9090
cd ${ROOT_DIR}/sdk/python; flake8 feast/ tests/
9191
cd ${ROOT_DIR}/sdk/python; black --check feast tests
9292

93-
cd ${ROOT_DIR}/tests/e2e; mypy .
94-
cd ${ROOT_DIR}/tests/e2e; isort . --check-only
95-
cd ${ROOT_DIR}/tests/e2e; flake8 .
96-
cd ${ROOT_DIR}/tests/e2e; black --check .
93+
cd ${ROOT_DIR}/tests; mypy e2e
94+
cd ${ROOT_DIR}/tests; isort e2e --check-only
95+
cd ${ROOT_DIR}/tests; flake8 e2e
96+
cd ${ROOT_DIR}/tests; black --check e2e
9797

9898
# Go SDK
9999

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
externalAccess:
2+
enabled: true
3+
service:
4+
loadBalancerIPs:
5+
- $feast_kafka_ip
6+
annotations:
7+
cloud.google.com/load-balancer-type: Internal
8+
loadBalancerSourceRanges:
9+
- 10.0.0.0/8
10+
- 172.16.0.0/12
11+
- 192.168.0.0/16
12+
13+
persistence:
14+
enabled: false
15+
16+
zookeeper:
17+
persistence:
18+
enabled: false
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cluster:
2+
nodes: 3
3+
replicas: 0
4+
externalAccess:
5+
enabled: true
6+
service:
7+
annotations:
8+
cloud.google.com/load-balancer-type: Internal
9+
loadBalancerIP:
10+
- $feast_redis_1_ip
11+
- $feast_redis_2_ip
12+
- $feast_redis_3_ip
13+
14+
persistence:
15+
enabled: false
16+
17+
usePassword: false

infra/scripts/setup-common-functions.sh

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -9,136 +9,6 @@ install_test_tools() {
99
apt-get -y install wget netcat kafkacat build-essential
1010
}
1111

12-
install_gcloud_sdk() {
13-
print_banner "Installing Google Cloud SDK"
14-
if [[ ! $(command -v gsutil) ]]; then
15-
CURRENT_DIR=$(dirname "$BASH_SOURCE")
16-
. "${CURRENT_DIR}"/install-google-cloud-sdk.sh
17-
fi
18-
19-
export GOOGLE_APPLICATION_CREDENTIALS
20-
gcloud auth activate-service-account --key-file ${GOOGLE_APPLICATION_CREDENTIALS}
21-
}
22-
23-
install_and_start_local_redis() {
24-
print_banner "Installing and tarting Redis at localhost:6379"
25-
# Allow starting serving in this Maven Docker image. Default set to not allowed.
26-
echo "exit 0" >/usr/sbin/policy-rc.d
27-
apt-get -y install redis-server >/var/log/redis.install.log
28-
redis-server --daemonize yes
29-
redis-cli ping
30-
}
31-
32-
install_and_start_local_redis_cluster() {
33-
print_banner "Installing Redis at localhost:6379"
34-
echo "exit 0" >/usr/sbin/policy-rc.d
35-
${SCRIPTS_DIR}/setup-redis-cluster.sh
36-
redis-cli -c -p 7000 ping
37-
}
38-
39-
install_and_start_local_postgres() {
40-
print_banner "Installing and starting Postgres at localhost:5432"
41-
apt-get -y install postgresql >/var/log/postgresql.install.log
42-
service postgresql start
43-
# Initialize with database: 'postgres', user: 'postgres', password: 'password'
44-
cat <<EOF >/tmp/update-postgres-role.sh
45-
psql -c "ALTER USER postgres PASSWORD 'password';"
46-
EOF
47-
chmod +x /tmp/update-postgres-role.sh
48-
su -s /bin/bash -c /tmp/update-postgres-role.sh postgres
49-
export PGPASSWORD=password
50-
pg_isready
51-
}
52-
53-
install_and_start_local_zookeeper_and_kafka() {
54-
print_banner "Installing and starting Zookeeper at localhost:2181 and Kafka at localhost:9092"
55-
wget -qO- https://www-eu.apache.org/dist/kafka/2.3.0/kafka_2.12-2.3.0.tgz | tar xz
56-
mv kafka_2.12-2.3.0/ /tmp/kafka
57-
58-
nohup /tmp/kafka/bin/zookeeper-server-start.sh /tmp/kafka/config/zookeeper.properties &>/var/log/zookeeper.log 2>&1 &
59-
${SCRIPTS_DIR}/wait-for-it.sh localhost:2181 --timeout=20
60-
tail -n10 /var/log/zookeeper.log
61-
62-
nohup /tmp/kafka/bin/kafka-server-start.sh /tmp/kafka/config/server.properties &>/var/log/kafka.log 2>&1 &
63-
${SCRIPTS_DIR}/wait-for-it.sh localhost:9092 --timeout=40
64-
tail -n10 /var/log/kafka.log
65-
kafkacat -b localhost:9092 -L
66-
}
67-
68-
build_feast_core_and_serving() {
69-
print_banner "Building Feast Core and Feast Serving"
70-
infra/scripts/download-maven-cache.sh \
71-
--archive-uri gs://feast-templocation-kf-feast/.m2.2020-08-19.tar \
72-
--output-dir /root/
73-
74-
# Build jars for Feast
75-
mvn --quiet --batch-mode -Dmaven.javadoc.skip=true -Dgpg.skip -DskipUTs=true clean package
76-
77-
ls -lh core/target/*jar
78-
ls -lh serving/target/*jar
79-
ls -lh job-controller/target/*jar
80-
}
81-
82-
start_feast_core() {
83-
print_banner "Starting Feast Core"
84-
85-
if [ -n "$1" ]; then
86-
echo "Custom Spring application.yml location provided: $1"
87-
export CONFIG_ARG="--spring.config.location=classpath:/application.yml,file://$1"
88-
fi
89-
90-
nohup java -jar core/target/feast-core-$FEAST_BUILD_VERSION-exec.jar $CONFIG_ARG &>/var/log/feast-core.log &
91-
${SCRIPTS_DIR}/wait-for-it.sh localhost:6565 --timeout=90
92-
93-
tail -n10 /var/log/feast-core.log
94-
nc -w2 localhost 6565 </dev/null
95-
}
96-
97-
start_feast_jobcontroller() {
98-
print_banner "Starting Feast Job Controller"
99-
100-
if [ -n "$1" ]; then
101-
echo "Custom Spring application.yml location provided: $1"
102-
export CONFIG_ARG="--spring.config.location=classpath:/application.yml,file://$1"
103-
fi
104-
105-
nohup java -jar job-controller/target/feast-job-controller-$FEAST_BUILD_VERSION-exec.jar $CONFIG_ARG &>/var/log/feast-jobcontroller.log &
106-
${SCRIPTS_DIR}/wait-for-it.sh localhost:6570 --timeout=90
107-
108-
tail -n10 /var/log/feast-jobcontroller.log
109-
nc -w2 localhost 6570 </dev/null
110-
}
111-
112-
start_feast_serving() {
113-
print_banner "Starting Feast Online Serving"
114-
115-
if [ -n "$1" ]; then
116-
echo "Custom Spring application.yml location provided: $1"
117-
export CONFIG_ARG="--spring.config.location=classpath:/application.yml,file://$1"
118-
fi
119-
120-
nohup java -jar serving/target/feast-serving-$FEAST_BUILD_VERSION-exec.jar $CONFIG_ARG &>/var/log/feast-serving-online.log &
121-
${SCRIPTS_DIR}/wait-for-it.sh localhost:6566 --timeout=60
122-
123-
tail -n100 /var/log/feast-serving-online.log
124-
nc -w2 localhost 6566 </dev/null
125-
}
126-
127-
install_python_with_miniconda_and_feast_sdk() {
128-
print_banner "Installing Python 3.7 with Miniconda and Feast SDK"
129-
# Install Python 3.7 with Miniconda
130-
wget -q https://repo.continuum.io/miniconda/Miniconda3-4.7.12-Linux-x86_64.sh \
131-
-O /tmp/miniconda.sh
132-
bash /tmp/miniconda.sh -b -p /root/miniconda -f
133-
/root/miniconda/bin/conda init
134-
source ~/.bashrc
135-
136-
# Install Feast Python SDK and test requirements
137-
make compile-protos-python
138-
pip install -qe sdk/python
139-
pip install -qr tests/e2e/requirements.txt
140-
}
141-
14212
print_banner() {
14313
echo "
14414
============================================================

0 commit comments

Comments
 (0)