35
35
import org .opensearch .common .util .concurrent .ThreadContext ;
36
36
import org .opensearch .commons .authuser .User ;
37
37
import org .opensearch .core .action .ActionListener ;
38
+ import org .opensearch .core .common .breaker .CircuitBreaker ;
39
+ import org .opensearch .core .common .breaker .CircuitBreakingException ;
38
40
import org .opensearch .core .rest .RestStatus ;
39
41
import org .opensearch .core .xcontent .NamedXContentRegistry ;
40
42
import org .opensearch .ml .common .FunctionName ;
43
45
import org .opensearch .ml .common .dataframe .DataFrameBuilder ;
44
46
import org .opensearch .ml .common .dataset .DataFrameInputDataset ;
45
47
import org .opensearch .ml .common .dataset .remote .RemoteInferenceInputDataSet ;
46
- import org .opensearch .ml .common .exception .MLLimitExceededException ;
47
48
import org .opensearch .ml .common .exception .MLResourceNotFoundException ;
48
49
import org .opensearch .ml .common .input .MLInput ;
49
50
import org .opensearch .ml .common .input .parameter .clustering .KMeansParams ;
@@ -242,7 +243,7 @@ public void testPrediction_MLLimitExceededException() {
242
243
243
244
doAnswer (invocation -> {
244
245
ActionListener <Boolean > listener = invocation .getArgument (3 );
245
- listener .onFailure (new MLLimitExceededException ("Memory Circuit Breaker is open, please check your resources!" ));
246
+ listener .onFailure (new CircuitBreakingException ("Memory Circuit Breaker is open, please check your resources!" , CircuitBreaker . Durability . TRANSIENT ));
246
247
return null ;
247
248
}).when (modelAccessControlHelper ).validateModelGroupAccess (any (), any (), any (), any ());
248
249
@@ -253,7 +254,7 @@ public void testPrediction_MLLimitExceededException() {
253
254
254
255
transportPredictionTaskAction .doExecute (null , mlPredictionTaskRequest , actionListener );
255
256
256
- ArgumentCaptor <Exception > argumentCaptor = ArgumentCaptor .forClass (OpenSearchStatusException .class );
257
+ ArgumentCaptor <Exception > argumentCaptor = ArgumentCaptor .forClass (CircuitBreakingException .class );
257
258
verify (actionListener ).onFailure (argumentCaptor .capture ());
258
259
assertEquals ("Memory Circuit Breaker is open, please check your resources!" , argumentCaptor .getValue ().getMessage ());
259
260
}
0 commit comments