Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix chart integration tests #1934

Merged
merged 5 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions helm-charts/seldon-single-model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ helm install $MY_MODEL_NAME seldonio/seldon-single-model --namespace $MODELS_NAM

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| annotations | list | `[]` | Annotations applied to the deployment |
| annotations | object | `{}` | Annotations applied to the deployment |
| apiVersion | string | `"machinelearning.seldon.io/v1"` | Version of the SeldonDeployment CRD |
| hpa.enabled | bool | `false` | Whether to add an HPA spec to the deployment |
| hpa.maxReplicas | int | `5` | Maximum number of replicas for HPA |
| hpa.metrics | list | `[{"resource":{"name":"cpu","targetAverageUtilization":10},"type":"Resource"}]` | Metrics that autoscaler should check |
| hpa.minReplicas | int | `1` | Minimum number of replicas for HPA |
| labels | list | `[]` | Labels applied to the deployment |
| labels | object | `{}` | Labels applied to the deployment |
| model.env | object | `{"LOG_LEVEL":"INFO"}` | Environment variables injected into the model's container |
| model.image | string | `""` | Docker image used by the model |
| model.logger.enabled | bool | `false` | |
Expand Down
26 changes: 13 additions & 13 deletions helm-charts/seldon-single-model/templates/seldondeployment.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"kind": "SeldonDeployment",
"apiVersion": "machinelearning.seldon.io/v1",
"apiVersion": "{{ .Values.apiVersion }}",
"metadata": {
"name": "{{ .Release.Name }}",
"namespace": "{{ .Release.Namespace }}"
"labels": [
{{- range $label := .Values.labels }}
"{{ $label }}"
{{- end }}
]
"namespace": "{{ .Release.Namespace }}",
"labels": {
{{- range $name, $val := .Values.labels }}
"{{ $name }}": "{{ $val }}"
{{ end -}}
}
},
"spec": {
"name": "{{ .Release.Name }}",
"annotations": [
{{- range $annotation := .Values.annotations }}
"{{ $annotation }}"
{{- end }}
],
"annotations": {
{{- range $name, $val := .Values.annotations }}
"{{ $name }}": "{{ $val }}"
{{ end -}}
},
"predictors": [
{
"name": "default",
Expand Down Expand Up @@ -45,7 +45,7 @@
"name": "{{ $var }}",
"value": "{{ $val }}"
},
{{- end }}
{{ end -}}
],
"resources": {{ .Values.model.resources | toJson }},
}
Expand Down
7 changes: 5 additions & 2 deletions helm-charts/seldon-single-model/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# apiVersion -- Version of the SeldonDeployment CRD
apiVersion: machinelearning.seldon.io/v1

model:
# model.image -- Docker image used by the model
image: ""
Expand All @@ -18,10 +21,10 @@ model:
replicas: 1

# labels -- Labels applied to the deployment
labels: []
labels: {}

# annotations -- Annotations applied to the deployment
annotations: []
annotations: {}

hpa:
# hpa.enabled -- Whether to add an HPA spec to the deployment
Expand Down
13 changes: 4 additions & 9 deletions testing/scripts/test_api_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
from seldon_e2e_utils import (
wait_for_rollout,
wait_for_status,
initial_rest_request,
rest_request_ambassador,
API_AMBASSADOR,
assert_model,
)
from subprocess import run

Expand All @@ -21,17 +19,14 @@ def test_api_version(namespace, apiVersion):
command = (
"helm install mymodel ../../helm-charts/seldon-single-model "
f"--set apiVersion={apiVersion} "
f"--set model.image=seldonio/fixed-model:0.1 "
f"--namespace {namespace}"
)
run(command, shell=True, check=True)

wait_for_status("mymodel", namespace)
wait_for_rollout("mymodel", namespace)
initial_rest_request("mymodel", namespace)

r = rest_request_ambassador("mymodel", namespace, API_AMBASSADOR)
assert_model("mymodel", namespace, initial=True)

assert r.status_code == 200
assert len(r.json()["data"]["tensor"]["values"]) == 1

run(f"helm delete mymodel", shell=True)
run("helm delete mymodel", shell=True)
37 changes: 18 additions & 19 deletions testing/scripts/test_helm_charts_clusterwide.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,40 @@
wait_for_rollout,
wait_for_status,
initial_rest_request,
initial_grpc_request,
rest_request_ambassador,
grpc_request_ambassador2,
API_AMBASSADOR,
assert_model,
)
from subprocess import run
import logging
import time


class TestClusterWide(object):

# Test singe model helm script with 4 API methods
def test_single_model(self, namespace):
run(
f"helm install mymodel ../../helm-charts/seldon-single-model --namespace {namespace}",
shell=True,
check=True,
command = (
"helm install mymodel ../../helm-charts/seldon-single-model "
f"--set model.image=seldonio/fixed-model:0.1 "
f"--namespace {namespace}"
)
run(command, shell=True, check=True)

wait_for_status("mymodel", namespace)
wait_for_rollout("mymodel", namespace)
initial_rest_request("mymodel", namespace)
logging.warning("Test Ambassador REST gateway")
r = rest_request_ambassador("mymodel", namespace, API_AMBASSADOR)
logging.warning(r.json())
assert r.status_code == 200
assert len(r.json()["data"]["tensor"]["values"]) == 1
run(f"helm delete mymodel", shell=True)

assert_model("mymodel", namespace, initial=True)

run("helm delete mymodel", shell=True)

# Test AB Test model helm script with 4 API methods
def test_abtest_model(self, namespace):
command = (
"helm install myabtest ../../helm-charts/seldon-abtest "
f"--namespace {namespace}"
)
run(
f"helm install myabtest ../../helm-charts/seldon-abtest --namespace {namespace}",
shell=True,
check=True,
command, shell=True, check=True,
)
wait_for_status("myabtest", namespace)
wait_for_rollout("myabtest", namespace, expected_deployments=2)
Expand All @@ -50,7 +49,7 @@ def test_abtest_model(self, namespace):
logging.warning(
"WARNING SKIPPING FLAKY AMBASSADOR TEST UNTIL AMBASSADOR GRPC ISSUE FIXED.."
)
run(f"helm delete myabtest", shell=True)
run("helm delete myabtest", shell=True)

# Test MAB Test model helm script with 4 API methods
def test_mab_model(self, namespace):
Expand All @@ -71,4 +70,4 @@ def test_mab_model(self, namespace):
logging.warning(
"WARNING SKIPPING FLAKY AMBASSADOR TEST UNTIL AMBASSADOR GRPC ISSUE FIXED.."
)
run(f"helm delete mymab", shell=True)
run("helm delete mymab", shell=True)
1 change: 0 additions & 1 deletion testing/scripts/test_rolling_updates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import time
import logging
import pytest
Expand Down