diff --git a/common/build.gradle b/common/build.gradle index 9a01a80b83..3aeb644d42 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -36,11 +36,11 @@ jacocoTestCoverageVerification { rule { limit { counter = 'LINE' - minimum = 0.6 //TODO: add more test to meet the coverage bar 0.9 + minimum = 0.8 //TODO: add more test to meet the coverage bar 0.9 } limit { counter = 'BRANCH' - minimum = 0.5 //TODO: add more test to meet the coverage bar 0.9 + minimum = 0.7 //TODO: add more test to meet the coverage bar 0.9 } } } diff --git a/common/src/main/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInput.java b/common/src/main/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInput.java index aec2d1b0b6..43568afb05 100644 --- a/common/src/main/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInput.java +++ b/common/src/main/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInput.java @@ -227,7 +227,7 @@ public void writeTo(StreamOutput output) throws IOException { } if (!CollectionUtils.isEmpty(backendRoles)) { output.writeBoolean(true); - output.writeOptionalStringCollection(backendRoles); + output.writeStringCollection(backendRoles); } else { output.writeBoolean(false); } diff --git a/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInputTests.java b/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInputTests.java index 4de9198785..81a6e36b64 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInputTests.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorInputTests.java @@ -7,6 +7,7 @@ import java.io.IOException; import java.io.UncheckedIOException; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -42,7 +43,6 @@ public void setUp(){ 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. mlCreateConnectorInput = MLCreateConnectorInput.builder() .name("test_connector_name") .description("this is a test connector") @@ -52,7 +52,8 @@ public void setUp(){ .credential(Map.of("key", "test_key_value")) .actions(List.of(action)) .access(AccessMode.PUBLIC) - .addAllBackendRoles(true) + .backendRoles(Arrays.asList("role1", "role2")) + .addAllBackendRoles(false) .build(); } diff --git a/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorRequestTests.java b/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorRequestTests.java index 581a4bdf33..6fe82d7f2b 100644 --- a/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorRequestTests.java +++ b/common/src/test/java/org/opensearch/ml/common/transport/connector/MLCreateConnectorRequestTests.java @@ -7,6 +7,7 @@ import java.io.IOException; import java.io.UncheckedIOException; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -52,7 +53,8 @@ public void setUp(){ .credential(Map.of("key", "test_key_value")) .actions(List.of(action)) .access(AccessMode.PUBLIC) - .addAllBackendRoles(true) + .backendRoles(Arrays.asList("role1", "role2")) + .addAllBackendRoles(false) .build(); }