-
Notifications
You must be signed in to change notification settings - Fork 831
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test to verify non200 response handling (#1132)
* add integ test to verify non200 response handling * fix test * run lint locally * use different namespace to avoid collision * try sending status back directly
- Loading branch information
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"apiVersion": "machinelearning.seldon.io/v1alpha2", | ||
"kind": "SeldonDeployment", | ||
"metadata": { | ||
"name": "mymodel" | ||
}, | ||
"spec": { | ||
"name": "mymodel", | ||
"oauth_key": "oauth-key", | ||
"oauth_secret": "oauth-secret", | ||
"predictors": [ | ||
{ | ||
"componentSpecs": [{ | ||
"spec": { | ||
"containers": [ | ||
{ | ||
"image": "seldonio/testmodel_rest_non200:0.1", | ||
"imagePullPolicy": "Never", | ||
"name": "model" | ||
} | ||
], | ||
"terminationGracePeriodSeconds": 1 | ||
} | ||
}], | ||
"graph": { | ||
"children": [], | ||
"name": "model", | ||
"endpoint": { | ||
"type" : "REST" | ||
}, | ||
"type": "MODEL" | ||
}, | ||
"name": "mymodel", | ||
"replicas": 1 | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from flask.json import jsonify | ||
|
||
|
||
class MyModelNon200Response(object): | ||
def __init__(self, metrics_ok=True): | ||
print("Init called") | ||
|
||
def predict_raw(self, message): | ||
status = { | ||
"code": 400, | ||
"reason": "exception message", | ||
"status": "FAILURE", | ||
"info": "exception caught", | ||
} | ||
|
||
return {"data": {"names": ["score"], "ndarray": []}, "status": status} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MODEL_NAME=MyModelNon200Response | ||
API_TYPE=REST | ||
SERVICE_TYPE=MODEL | ||
PERSISTENCE=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters