Skip to content

Commit

Permalink
Review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ukclivecox authored and seldondev committed Mar 25, 2020
1 parent 72bdf77 commit ee1874c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion executor/api/grpc/seldon/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestPredict(t *testing.T) {
},
}
url, _ := url.Parse("http://localhost")
server := NewGrpcSeldonServer(&p, test.SeldonMessageTestClient{}, url, "default")
server := NewGrpcSeldonServer(&p, &test.SeldonMessageTestClient{}, url, "default")

var sm proto.SeldonMessage
var data = ` {"data":{"ndarray":[[1.1,2.0]]}}`
Expand Down
13 changes: 9 additions & 4 deletions executor/predictor/predictor_process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ func createPredictorProcessWithRoute(t *testing.T, chosenRoute int) *PredictorPr
return &pp
}

func createPredictorProcessWithError(t *testing.T, errMethod *v1.PredictiveUnitMethod, err error) *PredictorProcess {
func createPredictorProcessWithError(t *testing.T, errMethod *v1.PredictiveUnitMethod, err error, errPayload payload.SeldonPayload) *PredictorProcess {
url, _ := url.Parse(testSourceUrl)
ctx := context.WithValue(context.TODO(), payload.SeldonPUIDHeader, testSeldonPuid)
pp := NewPredictorProcess(ctx, &test.SeldonMessageTestClient{ErrMethod: errMethod, Err: err}, logf.Log.WithName("SeldonMessageRestClient"), url, "default", map[string][]string{})
pp := NewPredictorProcess(ctx, &test.SeldonMessageTestClient{ErrMethod: errMethod, Err: err, ErrPayload: errPayload}, logf.Log.WithName("SeldonMessageRestClient"), url, "default", map[string][]string{})
return &pp
}

Expand Down Expand Up @@ -320,9 +320,14 @@ func TestModelError(t *testing.T) {

errMethod := v1.TRANSFORM_INPUT
chosenErr := errors.New("something bad happened")
pResp, err := createPredictorProcessWithError(t, &errMethod, chosenErr).Predict(graph, createPredictPayload(g))
errBytes := "{\"status\":\"failed\"}"
errPayload := payload.BytesPayload{
Msg: []byte(errBytes),
ContentType: "xyz",
}
pResp, err := createPredictorProcessWithError(t, &errMethod, chosenErr, &errPayload).Predict(graph, createPredictPayload(g))
g.Expect(err).ShouldNot(BeNil())
g.Expect(pResp).Should(BeNil())
g.Expect(pResp).To(Equal(&errPayload))
g.Expect(err.Error()).Should(Equal("something bad happened"))
}

Expand Down

0 comments on commit ee1874c

Please sign in to comment.