diff --git a/ml-algorithms/src/test/java/org/opensearch/ml/engine/algorithms/metrics_correlation/MetricsCorrelationTest.java b/ml-algorithms/src/test/java/org/opensearch/ml/engine/algorithms/metrics_correlation/MetricsCorrelationTest.java index 06fe1a4024..32d1df3a01 100644 --- a/ml-algorithms/src/test/java/org/opensearch/ml/engine/algorithms/metrics_correlation/MetricsCorrelationTest.java +++ b/ml-algorithms/src/test/java/org/opensearch/ml/engine/algorithms/metrics_correlation/MetricsCorrelationTest.java @@ -98,6 +98,7 @@ import static org.opensearch.ml.engine.algorithms.metrics_correlation.MetricsCorrelation.MODEL_CONTENT_HASH; //TODO: fix mockito error: Cannot mock/spy class org.opensearch.common.settings.Settings final class + @Ignore public class MetricsCorrelationTest { @Rule @@ -195,7 +196,7 @@ public void setUp() throws IOException, URISyntaxException { extendedInput = MetricsCorrelationInput.builder().inputData(extendedInputData).build(); } - @Ignore + @Test public void testWhenModelIdNotNullButModelIsNotDeployed() throws ExecuteException { metricsCorrelation.initModel(model, params); @@ -224,7 +225,7 @@ public void testWhenModelIdNotNullButModelIsNotDeployed() throws ExecuteExceptio assertNull(mlModelOutputs.get(0).getMCorrModelTensors()); } - @Ignore + @Test public void testExecuteWithModelInIndexAndEmptyOutput() throws ExecuteException, URISyntaxException { Map params = new HashMap<>(); @@ -287,7 +288,7 @@ public void testExecuteWithModelInIndexAndOneEvent() throws ExecuteException, UR assertNotNull(mlModelOutputs.get(0).getMCorrModelTensors().get(0).getSuspected_metrics()); } - @Ignore + @Test public void testExecuteWithNoModelIndexAndOneEvent() throws ExecuteException, URISyntaxException { Map params = new HashMap<>(); @@ -328,7 +329,7 @@ public void testExecuteWithNoModelIndexAndOneEvent() throws ExecuteException, UR assertNotNull(mlModelOutputs.get(0).getMCorrModelTensors().get(0).getSuspected_metrics()); } - @Ignore + @Test public void testExecuteWithModelInIndexAndInvokeDeployAndOneEvent() throws ExecuteException, URISyntaxException { Map params = new HashMap<>(); @@ -376,7 +377,7 @@ public void testExecuteWithModelInIndexAndInvokeDeployAndOneEvent() throws Execu } - @Ignore + @Test public void testExecuteWithNoModelInIndexAndOneEvent() throws ExecuteException, URISyntaxException { Map params = new HashMap<>(); @@ -418,7 +419,7 @@ public void testExecuteWithNoModelInIndexAndOneEvent() throws ExecuteException, assertNotNull(mlModelOutputs.get(0).getMCorrModelTensors().get(0).getSuspected_metrics()); } - @Ignore + @Test public void testGetModel() { ActionFuture mockedFuture = mock(ActionFuture.class); @@ -483,7 +484,7 @@ public void testSearchRequest() { assertEquals(MLModel.MODEL_VERSION_FIELD, versionQueryBuilder.fieldName()); } - @Ignore + @Test public void testRegisterModel() throws InterruptedException { doAnswer(invocation -> { @@ -507,7 +508,7 @@ public void testRegisterModel() throws InterruptedException { verify(mlRegisterModelResponseActionListener).onResponse(mlRegisterModelResponse); } - @Ignore + @Test public void testDeployModel() { doAnswer(invocation -> { @@ -522,7 +523,7 @@ public void testDeployModel() { verify(mlDeployModelResponseActionListener).onResponse(mlDeployModelResponse); } - @Ignore + @Test public void testDeployModelFail() { Exception ex = new ExecuteException("Testing"); @@ -535,14 +536,14 @@ public void testDeployModelFail() { verify(mlDeployModelResponseActionListener).onFailure(ex); } - @Ignore + @Test public void testWrongInput() throws ExecuteException { exceptionRule.expect(ExecuteException.class); metricsCorrelation.execute(mock(LocalSampleCalculatorInput.class)); } - @Ignore + @Test public void parseModelTensorOutput_NullOutput() { exceptionRule.expect(MLException.class); @@ -550,7 +551,7 @@ public void parseModelTensorOutput_NullOutput() { metricsCorrelation.parseModelTensorOutput(null, null); } - @Ignore + @Test public void initModel_NullModelZipFile() { exceptionRule.expect(IllegalArgumentException.class); @@ -560,7 +561,7 @@ public void initModel_NullModelZipFile() { metricsCorrelation.initModel(model, params); } - @Ignore + @Test public void initModel_NullModelHelper() throws URISyntaxException { exceptionRule.expect(IllegalArgumentException.class); @@ -570,7 +571,7 @@ public void initModel_NullModelHelper() throws URISyntaxException { metricsCorrelation.initModel(model, params); } - @Ignore + @Test public void initModel_NullMLEngine() throws URISyntaxException { exceptionRule.expect(IllegalArgumentException.class); @@ -581,7 +582,7 @@ public void initModel_NullMLEngine() throws URISyntaxException { metricsCorrelation.initModel(model, params); } - @Ignore + @Test public void initModel_NullModelId() throws URISyntaxException { exceptionRule.expect(IllegalArgumentException.class); @@ -591,7 +592,7 @@ public void initModel_NullModelId() throws URISyntaxException { metricsCorrelation.initModel(model, params); } - @Ignore + @Test public void initModel_WrongFunctionName() { exceptionRule.expect(IllegalArgumentException.class); diff --git a/plugin/build.gradle b/plugin/build.gradle index 7ff0c70565..868ee9d52b 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -293,17 +293,10 @@ List jacocoExclusions = [ 'org.opensearch.ml.action.connector.DeleteConnectorTransportAction.1', 'org.opensearch.ml.action.connector.TransportCreateConnectorAction', 'org.opensearch.ml.action.connector.SearchConnectorTransportAction', - 'org.opensearch.ml.rest.RestMLCreateConnectorAction' + 'org.opensearch.ml.rest.RestMLCreateConnectorAction', 'org.opensearch.ml.action.connector.SearchConnectorTransportAction', 'org.opensearch.ml.model.MLModelGroupManager', - 'org.opensearch.ml.action.upload_chunk.TransportRegisterModelMetaAction', - 'org.opensearch.ml.helper.ModelAccessControlHelper', - 'org.opensearch.ml.action.models.DeleteModelTransportAction', - 'org.opensearch.ml.action.models.DeleteModelTransportAction.1', - 'org.opensearch.ml.action.models.DeleteModelTransportAction.2', - 'org.opensearch.ml.action.register.TransportRegisterModelAction', - 'org.opensearch.ml.action.model_group.TransportRegisterModelGroupAction', - 'org.opensearch.ml.action.model_group.TransportUpdateModelGroupAction' + 'org.opensearch.ml.helper.ModelAccessControlHelper' ] jacocoTestCoverageVerification { diff --git a/plugin/src/main/java/org/opensearch/ml/action/model_group/TransportRegisterModelGroupAction.java b/plugin/src/main/java/org/opensearch/ml/action/model_group/TransportRegisterModelGroupAction.java index e4a49e72d0..89f65ded2c 100644 --- a/plugin/src/main/java/org/opensearch/ml/action/model_group/TransportRegisterModelGroupAction.java +++ b/plugin/src/main/java/org/opensearch/ml/action/model_group/TransportRegisterModelGroupAction.java @@ -57,7 +57,6 @@ public TransportRegisterModelGroupAction( this.threadPool = threadPool; this.client = client; this.clusterService = clusterService; - this.modelAccessControlHelper = modelAccessControlHelper; this.mlModelGroupManager = mlModelGroupManager; } diff --git a/plugin/src/test/java/org/opensearch/ml/action/model_group/SearchModelGroupITTests.java b/plugin/src/test/java/org/opensearch/ml/action/model_group/SearchModelGroupITTests.java index 91be363f95..b187cc4f8d 100644 --- a/plugin/src/test/java/org/opensearch/ml/action/model_group/SearchModelGroupITTests.java +++ b/plugin/src/test/java/org/opensearch/ml/action/model_group/SearchModelGroupITTests.java @@ -6,7 +6,6 @@ package org.opensearch.ml.action.model_group; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.rules.ExpectedException; import org.opensearch.action.search.SearchRequest; @@ -41,7 +40,6 @@ private void registerModelGroup() { this.modelGroupId = response.getModelGroupId(); } - @Ignore public void test_empty_body_search() { SearchRequest searchRequest = new SearchRequest(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); @@ -51,7 +49,6 @@ public void test_empty_body_search() { assertEquals(modelGroupId, response.getHits().getHits()[0].getId()); } - @Ignore public void test_matchAll_search() { SearchRequest searchRequest = new SearchRequest(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); @@ -62,7 +59,6 @@ public void test_matchAll_search() { assertEquals(modelGroupId, response.getHits().getHits()[0].getId()); } - @Ignore public void test_bool_search() { SearchRequest searchRequest = new SearchRequest(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); @@ -73,7 +69,6 @@ public void test_bool_search() { assertEquals(modelGroupId, response.getHits().getHits()[0].getId()); } - @Ignore public void test_term_search() { SearchRequest searchRequest = new SearchRequest(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); @@ -84,7 +79,6 @@ public void test_term_search() { assertEquals(modelGroupId, response.getHits().getHits()[0].getId()); } - @Ignore public void test_terms_search() { SearchRequest searchRequest = new SearchRequest(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); @@ -95,7 +89,6 @@ public void test_terms_search() { assertEquals(modelGroupId, response.getHits().getHits()[0].getId()); } - @Ignore public void test_range_search() { SearchRequest searchRequest = new SearchRequest(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); @@ -106,7 +99,6 @@ public void test_range_search() { assertEquals(modelGroupId, response.getHits().getHits()[0].getId()); } - @Ignore public void test_matchPhrase_search() { SearchRequest searchRequest = new SearchRequest(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); @@ -117,7 +109,6 @@ public void test_matchPhrase_search() { assertEquals(modelGroupId, response.getHits().getHits()[0].getId()); } - @Ignore public void test_queryString_search() { SearchRequest searchRequest = new SearchRequest(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); diff --git a/plugin/src/test/java/org/opensearch/ml/action/model_group/TransportRegisterModelGroupActionTests.java b/plugin/src/test/java/org/opensearch/ml/action/model_group/TransportRegisterModelGroupActionTests.java index 2009405884..cbbbc3e9a4 100644 --- a/plugin/src/test/java/org/opensearch/ml/action/model_group/TransportRegisterModelGroupActionTests.java +++ b/plugin/src/test/java/org/opensearch/ml/action/model_group/TransportRegisterModelGroupActionTests.java @@ -8,13 +8,11 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import java.util.Arrays; import java.util.List; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.rules.ExpectedException; import org.mockito.ArgumentCaptor; @@ -27,7 +25,6 @@ import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.settings.Settings; import org.opensearch.common.util.concurrent.ThreadContext; -import org.opensearch.commons.ConfigConstants; import org.opensearch.ml.common.AccessMode; import org.opensearch.ml.common.transport.model_group.MLRegisterModelGroupInput; import org.opensearch.ml.common.transport.model_group.MLRegisterModelGroupRequest; @@ -98,63 +95,14 @@ public void setup() { ); assertNotNull(transportRegisterModelGroupAction); - when(indexResponse.getId()).thenReturn("modelGroupID"); - - doAnswer(invocation -> { - ActionListener listener = invocation.getArgument(1); - listener.onResponse(indexResponse); - return null; - }).when(client).index(any(), any()); + } + public void test_Success() { doAnswer(invocation -> { - ActionListener actionListener = invocation.getArgument(0); - actionListener.onResponse(true); + ActionListener listener = invocation.getArgument(1); + listener.onResponse("modelGroupID"); return null; - }).when(mlIndicesHandler).initModelGroupIndexIfAbsent(any()); - - when(client.threadPool()).thenReturn(threadPool); - when(threadPool.getThreadContext()).thenReturn(threadContext); - } - - @Ignore - public void test_SuccessAddAllBackendRolesTrue() { - threadContext.putTransient(ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT, "alex|IT,HR|engineering,operations"); - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, null, true); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(MLRegisterModelGroupResponse.class); - verify(actionListener).onResponse(argumentCaptor.capture()); - } - - @Ignore - public void test_SuccessPublic() { - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, AccessMode.PUBLIC, null); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(MLRegisterModelGroupResponse.class); - verify(actionListener).onResponse(argumentCaptor.capture()); - } - - @Ignore - public void test_ExceptionAllAccessFieldsNull() { - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, null, null); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); - verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals( - "You must specify at least one backend role or make the model group public/private for registering it.", - argumentCaptor.getValue().getMessage() - ); - } - - @Ignore - public void test_ModelAccessModeNullAddAllBackendRolesTrue() { - threadContext.putTransient(ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT, "alex|IT,HR|engineering,operations"); - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); + }).when(mlModelGroupManager).createModelGroup(any(), any()); MLRegisterModelGroupRequest actionRequest = prepareRequest(null, null, true); transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); @@ -162,164 +110,19 @@ public void test_ModelAccessModeNullAddAllBackendRolesTrue() { verify(actionListener).onResponse(argumentCaptor.capture()); } - @Ignore - public void test_BackendRolesProvidedWithPublic() { - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, AccessMode.PUBLIC, true); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); - verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals("You can specify backend roles only for a model group with the restricted access mode.", argumentCaptor.getValue().getMessage()); - } - - @Ignore - public void test_BackendRolesProvidedWithPrivate() { - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, AccessMode.PRIVATE, true); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); - verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals("You can specify backend roles only for a model group with the restricted access mode.", argumentCaptor.getValue().getMessage()); - } - - @Ignore - public void test_AdminSpecifiedAddAllBackendRolesForRestricted() { - threadContext.putTransient(ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT, "admin|admin|all_access"); - when(modelAccessControlHelper.isAdmin(any())).thenReturn(true); - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, AccessMode.RESTRICTED, true); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); - verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals("Admin users cannot add all backend roles to a model group.", argumentCaptor.getValue().getMessage()); - } - - @Ignore - public void test_UserWithNoBackendRolesSpecifiedRestricted() { - threadContext.putTransient(ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT, "alex||engineering,operations"); - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, AccessMode.RESTRICTED, true); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); - verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals( - "You must have at least one backend role to register a restricted model group.", - argumentCaptor.getValue().getMessage() - ); - } - - @Ignore - public void test_UserSpecifiedRestrictedButNoBackendRolesFieldF() { - threadContext.putTransient(ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT, "alex|IT,HR|engineering,operations"); - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, AccessMode.RESTRICTED, null); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); - verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals( - "You must specify one or more backend roles or add all backend roles to register a restricted model group.", - argumentCaptor.getValue().getMessage() - ); - } - - @Ignore - public void test_RestrictedAndUserSpecifiedBothBackendRolesField() { - threadContext.putTransient(ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT, "alex|IT,HR|engineering,operations"); - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(backendRoles, AccessMode.RESTRICTED, true); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); - verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals( - "You cannot specify backend roles and add all backend roles at the same time.", - argumentCaptor.getValue().getMessage() - ); - } - - @Ignore - public void test_RestrictedAndUserSpecifiedIncorrectBackendRoles() { - threadContext.putTransient(ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT, "alex|IT,HR|engineering,operations"); - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); - - List incorrectBackendRole = Arrays.asList("Finance"); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(incorrectBackendRole, AccessMode.RESTRICTED, null); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); - verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals("You don't have the backend roles specified.", argumentCaptor.getValue().getMessage()); - } - - @Ignore - public void test_SuccessSecurityDisabledCluster() { - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(false); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, null, null); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(MLRegisterModelGroupResponse.class); - verify(actionListener).onResponse(argumentCaptor.capture()); - } - - @Ignore - public void test_ExceptionSecurityDisabledCluster() { - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(false); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, null, true); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); - verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals( - "You cannot specify model access control parameters because the Security plugin or model access control is disabled on your cluster.", - argumentCaptor.getValue().getMessage() - ); - } - - @Ignore - public void test_ExceptionFailedToInitModelGroupIndex() { - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(true); - - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, null, true); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); - verify(actionListener).onFailure(argumentCaptor.capture()); - } - - @Ignore - public void test_ExceptionFailedToIndexModelGroup() { - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(false); + public void test_Failure() { doAnswer(invocation -> { - ActionListener actionListener = invocation.getArgument(1); - actionListener.onFailure(new Exception("Index Not Found")); + ActionListener listener = invocation.getArgument(1); + listener.onFailure(new Exception("Failed to init model group index")); return null; - }).when(client).index(any(), any()); + }).when(mlModelGroupManager).createModelGroup(any(), any()); - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, null, null); + MLRegisterModelGroupRequest actionRequest = prepareRequest(null, AccessMode.PUBLIC, null); transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); - verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals("Index Not Found", argumentCaptor.getValue().getMessage()); - } - - @Ignore - public void test_ExceptionInitModelGroupIndexIfAbsent() { - when(modelAccessControlHelper.isSecurityEnabledAndModelAccessControlEnabled(any())).thenReturn(false); - doAnswer(invocation -> { - ActionListener actionListener = invocation.getArgument(0); - actionListener.onFailure(new Exception("Index Not Found")); - return null; - }).when(mlIndicesHandler).initModelGroupIndexIfAbsent(any()); - MLRegisterModelGroupRequest actionRequest = prepareRequest(null, null, null); - transportRegisterModelGroupAction.doExecute(task, actionRequest, actionListener); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals("Index Not Found", argumentCaptor.getValue().getMessage()); + assertEquals("Failed to init model group index", argumentCaptor.getValue().getMessage()); } private MLRegisterModelGroupRequest prepareRequest( diff --git a/plugin/src/test/java/org/opensearch/ml/action/model_group/UpdateModelGroupITTests.java b/plugin/src/test/java/org/opensearch/ml/action/model_group/UpdateModelGroupITTests.java index 3b5239d66d..19cf5b4bd5 100644 --- a/plugin/src/test/java/org/opensearch/ml/action/model_group/UpdateModelGroupITTests.java +++ b/plugin/src/test/java/org/opensearch/ml/action/model_group/UpdateModelGroupITTests.java @@ -6,7 +6,6 @@ package org.opensearch.ml.action.model_group; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.rules.ExpectedException; import org.opensearch.ml.action.MLCommonsIntegTestCase; @@ -42,7 +41,6 @@ private void registerModelGroup() { this.modelGroupId = response.getModelGroupId(); } - @Ignore public void test_update_public_model_group() { exceptionRule.expect(IllegalArgumentException.class); MLUpdateModelGroupInput input = new MLUpdateModelGroupInput( @@ -57,7 +55,6 @@ public void test_update_public_model_group() { client().execute(MLUpdateModelGroupAction.INSTANCE, createModelGroupRequest).actionGet(); } - @Ignore public void test_update_private_model_group() { exceptionRule.expect(IllegalArgumentException.class); MLUpdateModelGroupInput input = new MLUpdateModelGroupInput( @@ -72,11 +69,10 @@ public void test_update_private_model_group() { client().execute(MLUpdateModelGroupAction.INSTANCE, createModelGroupRequest).actionGet(); } - @Ignore public void test_update_model_group_without_access_fields() { MLUpdateModelGroupInput input = new MLUpdateModelGroupInput( modelGroupId, - "mock_model_group_name", + "mock_model_group_name2", "mock_model_group_desc", null, null, @@ -86,7 +82,6 @@ public void test_update_model_group_without_access_fields() { client().execute(MLUpdateModelGroupAction.INSTANCE, createModelGroupRequest).actionGet(); } - @Ignore public void test_update_protected_model_group_with_addAllBackendRoles_true() { exceptionRule.expect(IllegalArgumentException.class); MLUpdateModelGroupInput input = new MLUpdateModelGroupInput( @@ -101,7 +96,6 @@ public void test_update_protected_model_group_with_addAllBackendRoles_true() { client().execute(MLUpdateModelGroupAction.INSTANCE, createModelGroupRequest).actionGet(); } - @Ignore public void test_update_protected_model_group_with_backendRoles_notEmpty() { exceptionRule.expect(IllegalArgumentException.class); MLUpdateModelGroupInput input = new MLUpdateModelGroupInput( diff --git a/plugin/src/test/java/org/opensearch/ml/action/models/DeleteModelTransportActionTests.java b/plugin/src/test/java/org/opensearch/ml/action/models/DeleteModelTransportActionTests.java index 95da56311f..73bd333985 100644 --- a/plugin/src/test/java/org/opensearch/ml/action/models/DeleteModelTransportActionTests.java +++ b/plugin/src/test/java/org/opensearch/ml/action/models/DeleteModelTransportActionTests.java @@ -6,7 +6,9 @@ package org.opensearch.ml.action.models; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -20,6 +22,7 @@ import java.util.ArrayList; import java.util.Arrays; +import org.apache.lucene.search.TotalHits; import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; @@ -32,6 +35,7 @@ import org.opensearch.action.bulk.BulkItemResponse; import org.opensearch.action.delete.DeleteResponse; import org.opensearch.action.get.GetResponse; +import org.opensearch.action.search.SearchResponse; import org.opensearch.action.support.ActionFilters; import org.opensearch.client.Client; import org.opensearch.cluster.service.ClusterService; @@ -51,6 +55,9 @@ import org.opensearch.ml.common.transport.model.MLModelDeleteRequest; import org.opensearch.ml.helper.ModelAccessControlHelper; import org.opensearch.ml.model.MLModelManager; +import org.opensearch.ml.utils.TestHelper; +import org.opensearch.search.SearchHit; +import org.opensearch.search.SearchHits; import org.opensearch.test.OpenSearchTestCase; import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.TransportService; @@ -126,8 +133,6 @@ public void setup() throws IOException { when(threadPool.getThreadContext()).thenReturn(threadContext); } - @Ignore - public void testDeleteModel_Success() throws IOException { doAnswer(invocation -> { ActionListener listener = invocation.getArgument(1); @@ -153,7 +158,6 @@ public void testDeleteModel_Success() throws IOException { verify(actionListener).onResponse(deleteResponse); } - @Ignore public void testDeleteModel_Success_AlgorithmNotNull() throws IOException { doAnswer(invocation -> { ActionListener listener = invocation.getArgument(1); @@ -188,7 +192,133 @@ public void testDeleteModel_Success_AlgorithmNotNull() throws IOException { verify(actionListener).onResponse(deleteResponse); } - @Ignore + public void test_Success_ModelGroupIDNotNull_LastModelOfGroup() throws IOException { + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(1); + listener.onResponse(deleteResponse); + return null; + }).when(client).delete(any(), any()); + + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(2); + BulkByScrollResponse response = new BulkByScrollResponse(new ArrayList<>(), null); + listener.onResponse(response); + return null; + }).when(client).execute(any(), any(), any()); + + SearchResponse searchResponse = createModelGroupSearchResponse(1); + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(1); + listener.onResponse(searchResponse); + return null; + }).when(client).search(any(), isA(ActionListener.class)); + + MLModel mlModel = MLModel + .builder() + .modelId("test_id") + .modelGroupId("modelGroupID") + .modelState(MLModelState.REGISTERED) + .algorithm(FunctionName.TEXT_EMBEDDING) + .build(); + XContentBuilder content = mlModel.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS); + BytesReference bytesReference = BytesReference.bytes(content); + GetResult getResult = new GetResult("indexName", "111", 111l, 111l, 111l, true, bytesReference, null, null); + GetResponse getResponse = new GetResponse(getResult); + doAnswer(invocation -> { + ActionListener actionListener = invocation.getArgument(1); + actionListener.onResponse(getResponse); + return null; + }).when(client).get(any(), any()); + + deleteModelTransportAction.doExecute(null, mlModelDeleteRequest, actionListener); + verify(actionListener).onResponse(deleteResponse); + } + + public void test_Success_ModelGroupIDNotNull_NotLastModelOfGroup() throws IOException { + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(1); + listener.onResponse(deleteResponse); + return null; + }).when(client).delete(any(), any()); + + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(2); + BulkByScrollResponse response = new BulkByScrollResponse(new ArrayList<>(), null); + listener.onResponse(response); + return null; + }).when(client).execute(any(), any(), any()); + + SearchResponse searchResponse = createModelGroupSearchResponse(2); + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(1); + listener.onResponse(searchResponse); + return null; + }).when(client).search(any(), isA(ActionListener.class)); + + MLModel mlModel = MLModel + .builder() + .modelId("test_id") + .modelGroupId("modelGroupID") + .modelState(MLModelState.REGISTERED) + .algorithm(FunctionName.TEXT_EMBEDDING) + .build(); + XContentBuilder content = mlModel.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS); + BytesReference bytesReference = BytesReference.bytes(content); + GetResult getResult = new GetResult("indexName", "111", 111l, 111l, 111l, true, bytesReference, null, null); + GetResponse getResponse = new GetResponse(getResult); + doAnswer(invocation -> { + ActionListener actionListener = invocation.getArgument(1); + actionListener.onResponse(getResponse); + return null; + }).when(client).get(any(), any()); + + deleteModelTransportAction.doExecute(null, mlModelDeleteRequest, actionListener); + verify(actionListener).onResponse(deleteResponse); + } + + public void test_Failure_FailedToSearchLastModel() throws IOException { + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(1); + listener.onResponse(deleteResponse); + return null; + }).when(client).delete(any(), any()); + + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(2); + BulkByScrollResponse response = new BulkByScrollResponse(new ArrayList<>(), null); + listener.onResponse(response); + return null; + }).when(client).execute(any(), any(), any()); + + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(1); + listener.onFailure(new Exception("Failed to search Model index")); + return null; + }).when(client).search(any(), isA(ActionListener.class)); + + MLModel mlModel = MLModel + .builder() + .modelId("test_id") + .modelGroupId("modelGroupID") + .modelState(MLModelState.REGISTERED) + .algorithm(FunctionName.TEXT_EMBEDDING) + .build(); + XContentBuilder content = mlModel.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS); + BytesReference bytesReference = BytesReference.bytes(content); + GetResult getResult = new GetResult("indexName", "111", 111l, 111l, 111l, true, bytesReference, null, null); + GetResponse getResponse = new GetResponse(getResult); + doAnswer(invocation -> { + ActionListener actionListener = invocation.getArgument(1); + actionListener.onResponse(getResponse); + return null; + }).when(client).get(any(), any()); + + deleteModelTransportAction.doExecute(null, mlModelDeleteRequest, actionListener); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); + verify(actionListener).onFailure(argumentCaptor.capture()); + assertEquals("Failed to search Model index", argumentCaptor.getValue().getMessage()); + } + public void test_UserHasNoAccessException() throws IOException { GetResponse getResponse = prepareMLModel(MLModelState.REGISTERED); doAnswer(invocation -> { @@ -206,7 +336,7 @@ public void test_UserHasNoAccessException() throws IOException { deleteModelTransportAction.doExecute(null, mlModelDeleteRequest, actionListener); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); verify(actionListener).onFailure(argumentCaptor.capture()); - assertEquals("User Doesn't have privilege to perform this operation on this model", argumentCaptor.getValue().getMessage()); + assertEquals("User doesn't have privilege to perform this operation on this model", argumentCaptor.getValue().getMessage()); } public void testDeleteModel_CheckModelState() throws IOException { @@ -239,7 +369,6 @@ public void testDeleteModel_ModelNotFoundException() throws IOException { assertEquals("Fail to find model", argumentCaptor.getValue().getMessage()); } - @Ignore public void testDeleteModel_ResourceNotFoundException() throws IOException { doAnswer(invocation -> { ActionListener listener = invocation.getArgument(1); @@ -311,7 +440,6 @@ public void testDeleteModelChunks_Success() { verify(actionListener).onResponse(deleteResponse); } - @Ignore public void testDeleteModel_RuntimeException() throws IOException { GetResponse getResponse = prepareMLModel(MLModelState.REGISTERED); doAnswer(invocation -> { @@ -415,4 +543,20 @@ public GetResponse prepareMLModel(MLModelState mlModelState) throws IOException GetResponse getResponse = new GetResponse(getResult); return getResponse; } + + private SearchResponse createModelGroupSearchResponse(long totalHits) throws IOException { + SearchResponse searchResponse = mock(SearchResponse.class); + String modelContent = "{\n" + + " \"created_time\": 1684981986069,\n" + + " \"access\": \"public\",\n" + + " \"latest_version\": 0,\n" + + " \"last_updated_time\": 1684981986069,\n" + + " \"name\": \"model_group_IT\",\n" + + " \"description\": \"This is an example description\"\n" + + " }"; + SearchHit modelGroup = SearchHit.fromXContent(TestHelper.parser(modelContent)); + SearchHits hits = new SearchHits(new SearchHit[] { modelGroup }, new TotalHits(totalHits, TotalHits.Relation.EQUAL_TO), Float.NaN); + when(searchResponse.getHits()).thenReturn(hits); + return searchResponse; + } } diff --git a/plugin/src/test/java/org/opensearch/ml/action/models/SearchModelITTests.java b/plugin/src/test/java/org/opensearch/ml/action/models/SearchModelITTests.java index d02cdebf5a..d5c1347e26 100644 --- a/plugin/src/test/java/org/opensearch/ml/action/models/SearchModelITTests.java +++ b/plugin/src/test/java/org/opensearch/ml/action/models/SearchModelITTests.java @@ -6,7 +6,6 @@ package org.opensearch.ml.action.models; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.rules.ExpectedException; import org.opensearch.action.search.SearchRequest; @@ -85,7 +84,7 @@ private void registerModelVersion() throws InterruptedException { * the method, so if we use multiple methods, then we always need to wait a long time until the model version registration * completes, making all the tests in one method can make the overall process faster. */ - @Ignore + public void test_all() { test_empty_body_search(); test_matchAll_search(); diff --git a/plugin/src/test/java/org/opensearch/ml/action/register/TransportRegisterModelActionTests.java b/plugin/src/test/java/org/opensearch/ml/action/register/TransportRegisterModelActionTests.java index 66f37a4beb..9d73d708ab 100644 --- a/plugin/src/test/java/org/opensearch/ml/action/register/TransportRegisterModelActionTests.java +++ b/plugin/src/test/java/org/opensearch/ml/action/register/TransportRegisterModelActionTests.java @@ -22,7 +22,6 @@ import java.util.Map; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.rules.ExpectedException; import org.mockito.ArgumentCaptor; @@ -208,7 +207,6 @@ public void setup() { when(threadPool.getThreadContext()).thenReturn(threadContext); } - @Ignore public void testDoExecute_userHasNoAccessException() { doAnswer(invocation -> { ActionListener listener = invocation.getArgument(3); @@ -216,13 +214,12 @@ public void testDoExecute_userHasNoAccessException() { return null; }).when(modelAccessControlHelper).validateModelGroupAccess(any(), any(), any(), any()); - transportRegisterModelAction.doExecute(task, prepareRequest("test url"), actionListener); + transportRegisterModelAction.doExecute(task, prepareRequest("test url", "testModelGroupsID"), actionListener); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); verify(actionListener).onFailure(argumentCaptor.capture()); assertEquals("You don't have permissions to perform this operation on this model.", argumentCaptor.getValue().getMessage()); } - @Ignore public void testDoExecute_successWithLocalNodeEqualToClusterNode() { when(node1.getId()).thenReturn("NodeId1"); when(node2.getId()).thenReturn("NodeId1"); @@ -233,20 +230,54 @@ public void testDoExecute_successWithLocalNodeEqualToClusterNode() { handler.handleResponse(forwardResponse); return null; }).when(transportService).sendRequest(any(), any(), any(), any()); - transportRegisterModelAction.doExecute(task, prepareRequest(), actionListener); + transportRegisterModelAction.doExecute(task, prepareRequest("http://test_url", "modelGroupID"), actionListener); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(MLRegisterModelResponse.class); verify(actionListener).onResponse(argumentCaptor.capture()); } - @Ignore + public void testDoExecute_successWithCreateModelGroup() { + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(1); + listener.onResponse("modelGroupID"); + return null; + }).when(mlModelGroupManager).createModelGroup(any(), any()); + + when(node1.getId()).thenReturn("NodeId1"); + when(node2.getId()).thenReturn("NodeId1"); + + MLForwardResponse forwardResponse = Mockito.mock(MLForwardResponse.class); + doAnswer(invocation -> { + ActionListenerResponseHandler handler = invocation.getArgument(3); + handler.handleResponse(forwardResponse); + return null; + }).when(transportService).sendRequest(any(), any(), any(), any()); + + transportRegisterModelAction.doExecute(task, prepareRequest("http://test_url", null), actionListener); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(MLRegisterModelResponse.class); + verify(actionListener).onResponse(argumentCaptor.capture()); + } + + public void testDoExecute_failureWithCreateModelGroup() { + doAnswer(invocation -> { + ActionListener listener = invocation.getArgument(1); + listener.onFailure(new Exception("Failed to create Model Group")); + return null; + }).when(mlModelGroupManager).createModelGroup(any(), any()); + + transportRegisterModelAction.doExecute(task, prepareRequest("http://test_url", null), actionListener); + + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); + verify(actionListener).onFailure(argumentCaptor.capture()); + assertEquals("Failed to create Model Group", argumentCaptor.getValue().getMessage()); + } + public void testDoExecute_invalidURL() { - transportRegisterModelAction.doExecute(task, prepareRequest("test url"), actionListener); + transportRegisterModelAction.doExecute(task, prepareRequest("test url", "testModelGroupsID"), actionListener); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); verify(actionListener).onFailure(argumentCaptor.capture()); assertEquals("URL can't match trusted url regex", argumentCaptor.getValue().getMessage()); } - @Ignore public void testDoExecute_successWithLocalNodeNotEqualToClusterNode() { when(node1.getId()).thenReturn("NodeId1"); when(node2.getId()).thenReturn("NodeId2"); @@ -257,23 +288,21 @@ public void testDoExecute_successWithLocalNodeNotEqualToClusterNode() { return null; }).when(transportService).sendRequest(any(), any(), any(), any()); - transportRegisterModelAction.doExecute(task, prepareRequest(), actionListener); + transportRegisterModelAction.doExecute(task, prepareRequest("http://test_url", "modelGroupID"), actionListener); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(MLRegisterModelResponse.class); verify(actionListener).onResponse(argumentCaptor.capture()); } - @Ignore public void testDoExecute_FailToSendForwardRequest() { when(node1.getId()).thenReturn("NodeId1"); when(node2.getId()).thenReturn("NodeId2"); doThrow(new RuntimeException("error")).when(transportService).sendRequest(any(), any(), any(), any()); - transportRegisterModelAction.doExecute(task, prepareRequest(), actionListener); + transportRegisterModelAction.doExecute(task, prepareRequest("http://test_url", "modelGroupID"), actionListener); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(MLRegisterModelResponse.class); verify(actionListener).onResponse(argumentCaptor.capture()); } - @Ignore public void testTransportRegisterModelActionDoExecuteWithDispatchException() { doAnswer(invocation -> { ActionListener listener = invocation.getArgument(0); @@ -282,12 +311,11 @@ public void testTransportRegisterModelActionDoExecuteWithDispatchException() { }).when(mlTaskDispatcher).dispatch(any()); when(node1.getId()).thenReturn("NodeId1"); when(clusterService.localNode()).thenReturn(node1); - transportRegisterModelAction.doExecute(task, prepareRequest(), actionListener); + transportRegisterModelAction.doExecute(task, prepareRequest("http://test_url", "modelGroupID"), actionListener); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); verify(actionListener).onFailure(argumentCaptor.capture()); } - @Ignore public void test_ValidationFailedException() { doAnswer(invocation -> { ActionListener listener = invocation.getArgument(3); @@ -295,13 +323,12 @@ public void test_ValidationFailedException() { return null; }).when(modelAccessControlHelper).validateModelGroupAccess(any(), any(), any(), any()); - transportRegisterModelAction.doExecute(task, prepareRequest(), actionListener); + transportRegisterModelAction.doExecute(task, prepareRequest("http://test_url", "modelGroupID"), actionListener); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); verify(actionListener).onFailure(argumentCaptor.capture()); assertEquals("Failed to validate access", argumentCaptor.getValue().getMessage()); } - @Ignore public void testTransportRegisterModelActionDoExecuteWithCreateTaskException() { doAnswer(invocation -> { ActionListener listener = invocation.getArgument(1); @@ -310,7 +337,7 @@ public void testTransportRegisterModelActionDoExecuteWithCreateTaskException() { }).when(mlTaskManager).createMLTask(any(), any()); when(node1.getId()).thenReturn("NodeId1"); when(clusterService.localNode()).thenReturn(node1); - transportRegisterModelAction.doExecute(task, prepareRequest(), actionListener); + transportRegisterModelAction.doExecute(task, prepareRequest("http://test_url", "modelGroupID"), actionListener); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Exception.class); verify(actionListener).onFailure(argumentCaptor.capture()); } @@ -319,6 +346,8 @@ public void test_execute_registerRemoteModel_withConnectorId_success() { MLRegisterModelRequest request = mock(MLRegisterModelRequest.class); MLRegisterModelInput input = mock(MLRegisterModelInput.class); when(request.getRegisterModelInput()).thenReturn(input); + when(input.getModelName()).thenReturn("Test Model"); + when(input.getModelGroupId()).thenReturn("modelGroupID"); when(input.getConnectorId()).thenReturn("mockConnectorId"); when(input.getFunctionName()).thenReturn(FunctionName.REMOTE); doAnswer(invocation -> { @@ -379,6 +408,8 @@ public void test_execute_registerRemoteModel_withInternalConnector_success() { MLRegisterModelRequest request = mock(MLRegisterModelRequest.class); MLRegisterModelInput input = mock(MLRegisterModelInput.class); when(request.getRegisterModelInput()).thenReturn(input); + when(input.getModelName()).thenReturn("Test Model"); + when(input.getModelGroupId()).thenReturn("modelGroupID"); when(input.getFunctionName()).thenReturn(FunctionName.REMOTE); Connector connector = mock(Connector.class); when(input.getConnector()).thenReturn(connector); @@ -427,17 +458,12 @@ public void test_execute_registerRemoteModel_withInternalConnector_predictEndpoi ); } - private MLRegisterModelRequest prepareRequest() { - return prepareRequest("http://test_url"); - } - - private MLRegisterModelRequest prepareRequest(String url) { + private MLRegisterModelRequest prepareRequest(String url, String modelGroupID) { MLRegisterModelInput registerModelInput = MLRegisterModelInput .builder() .functionName(FunctionName.BATCH_RCF) .deployModel(true) - .modelGroupId("testModelGroupsID") - .version("1.0") + .modelGroupId(modelGroupID) .modelName("Test Model") .modelConfig( new TextEmbeddingModelConfig( diff --git a/plugin/src/test/java/org/opensearch/ml/breaker/MLCircuitBreakerServiceTests.java b/plugin/src/test/java/org/opensearch/ml/breaker/MLCircuitBreakerServiceTests.java index f6a2eb5767..8e5e503c82 100644 --- a/plugin/src/test/java/org/opensearch/ml/breaker/MLCircuitBreakerServiceTests.java +++ b/plugin/src/test/java/org/opensearch/ml/breaker/MLCircuitBreakerServiceTests.java @@ -14,7 +14,6 @@ import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -95,7 +94,6 @@ public void testClearBreakers() { } @Test - @Ignore public void testInit() { Settings settings = Settings.builder().put(ML_COMMONS_NATIVE_MEM_THRESHOLD.getKey(), 90).build(); ClusterSettings clusterSettings = new ClusterSettings(settings, new HashSet<>(Arrays.asList(ML_COMMONS_NATIVE_MEM_THRESHOLD)));