Skip to content

Commit d935855

Browse files
authored
Add actual pytests to integration tests (#227)
1 parent 112f082 commit d935855

File tree

24 files changed

+1548
-39
lines changed

24 files changed

+1548
-39
lines changed

.circleci/config.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,48 @@ jobs:
138138
name: Pre-load model-engine image to minikube
139139
command: |
140140
minikube --logtostderr -v 1 image load model-engine:$CIRCLE_SHA1
141+
- run:
142+
name: Pre-load integration test images to minikube
143+
command: |
144+
docker build -f model-engine/model_engine_server/inference/pytorch_or_tf.base.Dockerfile \
145+
--build-arg BASE_IMAGE=pytorch/pytorch:1.7.1-cuda11.0-cudnn8-runtime \
146+
--build-arg REQUIREMENTS_FILE="$CIRCLE_SHA1-base-requirements.txt" \
147+
-t temp:1.7.1-cuda11.0-cudnn8-runtime-$CIRCLE_SHA1 .
148+
149+
touch $CIRCLE_SHA1-requirements.txt
150+
echo -e "cloudpickle==2.1.0\npyyaml==6.0" > $CIRCLE_SHA1-requirements.txt
151+
152+
DOCKER_BUILDKIT=1 docker build -f model-engine/model_engine_server/inference/pytorch_or_tf.user.Dockerfile \
153+
--build-arg BASE_IMAGE=temp:1.7.1-cuda11.0-cudnn8-runtime-$CIRCLE_SHA1 \
154+
--build-arg REQUIREMENTS_FILE="$CIRCLE_SHA1-requirements.txt" \
155+
-t $CIRCLECI_AWS_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com/hosted-model-inference/async-pytorch:1.7.1-cuda11.0-cudnn8-runtime-$CIRCLE_SHA1-021694 .
156+
rm $CIRCLE_SHA1-requirements.txt
157+
158+
minikube --logtostderr -v 1 image load $CIRCLECI_AWS_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com/hosted-model-inference/async-pytorch:1.7.1-cuda11.0-cudnn8-runtime-$CIRCLE_SHA1-021694
141159
- run:
142160
name: Install helm chart
143161
command: |
144162
pushd $HOME/project/charts
145163
cat model-engine/values_circleci.yaml | envsubst > model-engine/values_circleci_subst.yaml
146164
helm install model-engine model-engine --values model-engine/values_circleci_subst.yaml --set tag=$CIRCLE_SHA1 --atomic --debug
165+
- run:
166+
name: Change python version to 3.8.12
167+
command: |
168+
pyenv install 3.8.12
169+
pyenv global 3.8.12
170+
- run:
171+
name: Install integration test dependencies
172+
command: |
173+
sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libssl-dev python3-dev
174+
pip install -r model-engine/requirements.txt
175+
- install_client
176+
- install_server
177+
- run:
178+
name: Run integration tests
179+
command: |
180+
pushd $HOME/project
181+
kubectl port-forward svc/model-engine 5001:80 &
182+
GIT_TAG=$CIRCLE_SHA1 pytest integration_tests
147183
148184
executors:
149185
ubuntu-large:
@@ -188,6 +224,7 @@ commands:
188224
- run:
189225
name: Install LLM Engine client
190226
command: |
227+
pip install --upgrade pip
191228
pip install -e $HOME/project/clients/python
192229
run_unit_tests_python_client:
193230
description: Unit tests of the python client

charts/model-engine/templates/_helpers.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ env:
281281
- name: REDIS_AUTH_TOKEN
282282
value: {{ .Values.redis.auth }}
283283
{{- end }}
284+
{{- if eq .Values.context "circleci" }}
285+
- name: CIRCLECI
286+
value: "true"
287+
{{- end }}
284288
{{- end }}
285289

286290
{{- define "modelEngine.serviceEnvGitTagFromHelmVar" }}

charts/model-engine/templates/service_config_map.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,32 @@ data:
2323
{{ $key }}: {{ $value | quote }}
2424
{{- end }}
2525
{{- end }}
26+
27+
---
28+
29+
apiVersion: v1
30+
kind: ConfigMap
31+
metadata:
32+
name: {{ include "modelEngine.fullname" . }}-service-config
33+
namespace: {{ .Values.config.values.launch.endpoint_namespace }}
34+
labels:
35+
{{- include "modelEngine.labels" . | nindent 4 }}
36+
annotations:
37+
"helm.sh/hook": pre-install,pre-upgrade
38+
"helm.sh/hook-weight": "-2"
39+
data:
40+
launch_service_config: |-
41+
datadog_trace_enabled: {{ .Values.datadog_trace_enabled | default false | quote }}
42+
{{- with .Values.config.values.launch }}
43+
{{- range $key, $value := . }}
44+
{{ $key }}: {{ $value | quote }}
45+
{{- end }}
46+
{{- end }}
47+
infra_service_config: |-
48+
env: {{ .Values.context | quote }}
49+
{{- with .Values.config.values.infra }}
50+
{{- range $key, $value := . }}
51+
{{ $key }}: {{ $value | quote }}
52+
{{- end }}
53+
{{- end }}
2654
{{- end }}

charts/model-engine/templates/service_template_config_map.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ data:
143143
name: http
144144
{{- else if eq $mode "streaming" }}
145145
- name: http-forwarder
146-
image: {{ $forwarder_repository }}:{{ $tag }}
146+
image: {{ $forwarder_repository }}:${GIT_TAG}
147147
imagePullPolicy: IfNotPresent
148148
command:
149149
- /usr/bin/dumb-init

charts/model-engine/values_circleci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ config:
8282
dns_host_domain: localhost
8383
default_region: us-west-2
8484
ml_account_id: "$CIRCLECI_AWS_ACCOUNT_ID"
85-
docker_repo_prefix: "CIRCLECI_AWS_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com"
85+
docker_repo_prefix: "$CIRCLECI_AWS_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com"
8686
redis_host: redis-message-broker-master.default
8787
s3_bucket: "$CIRCLECI_AWS_S3_BUCKET"
8888
profile_ml_worker: "default"

integration_tests/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)