-
Notifications
You must be signed in to change notification settings - Fork 138
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
Add more UT for remote inference classes #1077
Conversation
Signed-off-by: Sicheng Song <[email protected]>
Codecov Report
@@ Coverage Diff @@
## 2.x #1077 +/- ##
============================================
+ Coverage 77.95% 78.80% +0.85%
- Complexity 2071 2102 +31
============================================
Files 167 167
Lines 8558 8567 +9
Branches 857 862 +5
============================================
+ Hits 6671 6751 +80
+ Misses 1503 1423 -80
- Partials 384 393 +9
Flags with carried forward coverage won't be shown. Click here to find out more. |
Signed-off-by: Sicheng Song <[email protected]>
String postProcessFunction = MLPostProcessFunction.OPENAI_EMBEDDING; | ||
ConnectorAction action = new ConnectorAction(actionType, method, url, headers, mlCreateConnectorRequestBody, preProcessFunction, postProcessFunction); | ||
|
||
// java.lang.IllegalStateException: unexpected byte [0x6f] will be thrown if we specify backendRoles field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change line 230 of MLCreateConnectorInput
output.writeOptionalStringCollection(backendRoles);
to
output.writeStringCollection(backendRoles);
Tested with this, it can work, won't throw such error
MLCreateConnectorInput input = MLCreateConnectorInput.builder()
.name("test_connector_name")
.description("this is a test connector")
.version("1")
.protocol("http")
.parameters(Map.of("input", "test input value"))
.credential(Map.of("key", "test_key_value"))
.access(AccessMode.PUBLIC)
.addAllBackendRoles(true)
.backendRoles(Arrays.asList("r1"))
.build();
BytesStreamOutput output = new BytesStreamOutput();
input.writeTo(output);
MLCreateConnectorInput input2 = new MLCreateConnectorInput(output.bytes().streamInput());
Assert.assertNotNull(input2);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we increase the line and branch coverage back to 0.7 or 0.8 in the gradle file?
Signed-off-by: Sicheng Song <[email protected]>
Signed-off-by: Sicheng Song <[email protected]>
MLConnectorGetResponse parsedResponse = new MLConnectorGetResponse(bytesStreamOutput.bytes().streamInput()); | ||
assertNotEquals(response, parsedResponse); | ||
assertNotSame(response.mlConnector, parsedResponse.mlConnector); | ||
assertEquals(response.mlConnector, parsedResponse.mlConnector); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class behaves different from https://github.com/opensearch-project/ml-commons/blob/2.x/common/src/test/java/org/opensearch/ml/common/transport/model/MLModelGetResponseTest.java#L48, is this expected? @ylwu-amzn
(cherry picked from commit daab3b7)
Signed-off-by: Sicheng Song <[email protected]>
Signed-off-by: Sicheng Song <[email protected]>
Description
This PR will add test coverage to remote inference classes and some of the other classes.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.