88package org .elasticsearch .xpack .inference .integration ;
99
1010import org .elasticsearch .ElasticsearchStatusException ;
11+ import org .elasticsearch .ResourceAlreadyExistsException ;
1112import org .elasticsearch .ResourceNotFoundException ;
1213import org .elasticsearch .TransportVersion ;
1314import org .elasticsearch .action .ActionListener ;
@@ -906,7 +907,7 @@ public void testStoreModel_ThrowsException_WhenFailureIsAVersionConflict() {
906907 var model = TestModel .createRandomInstance ();
907908 assertStoreModel (modelRegistry , model );
908909
909- var exception = expectThrows (ElasticsearchStatusException .class , () -> assertStoreModel (modelRegistry , model ));
910+ var exception = expectThrows (ResourceAlreadyExistsException .class , () -> assertStoreModel (modelRegistry , model ));
910911 assertThat (exception .status (), Matchers .is (RestStatus .BAD_REQUEST ));
911912 assertThat (
912913 exception .getMessage (),
@@ -941,7 +942,7 @@ public void testStoreModel_DoesNotDeleteIndexDocs_WhenModelAlreadyExists() {
941942 PlainActionFuture <Boolean > secondStoreListener = new PlainActionFuture <>();
942943 modelRegistry .storeModel (model , secondStoreListener , TimeValue .THIRTY_SECONDS );
943944
944- var exception = expectThrows (ElasticsearchStatusException .class , () -> secondStoreListener .actionGet (TimeValue .THIRTY_SECONDS ));
945+ var exception = expectThrows (ResourceAlreadyExistsException .class , () -> secondStoreListener .actionGet (TimeValue .THIRTY_SECONDS ));
945946 assertThat (exception .getMessage (), containsString ("already exists" ));
946947 assertThat (exception .status (), Matchers .is (RestStatus .BAD_REQUEST ));
947948 assertIndicesContainExpectedDocsCount (model , 2 );
@@ -964,7 +965,7 @@ private void storeCorruptedModelThenStoreModel(boolean storeSecrets) {
964965 PlainActionFuture <Boolean > storeListener = new PlainActionFuture <>();
965966 modelRegistry .storeModel (model , storeListener , TimeValue .THIRTY_SECONDS );
966967
967- var exception = expectThrows (ElasticsearchStatusException .class , () -> storeListener .actionGet (TimeValue .THIRTY_SECONDS ));
968+ var exception = expectThrows (ResourceAlreadyExistsException .class , () -> storeListener .actionGet (TimeValue .THIRTY_SECONDS ));
968969 assertThat (exception .getMessage (), containsString ("already exists" ));
969970 assertThat (exception .status (), Matchers .is (RestStatus .BAD_REQUEST ));
970971
0 commit comments