3434import org .elasticsearch .xpack .inference .services .sagemaker .schema .SageMakerSchemas ;
3535import org .elasticsearch .xpack .inference .services .sagemaker .schema .SageMakerStreamSchema ;
3636import org .junit .Before ;
37- import org .junit .Test ;
3837
3938import java .io .IOException ;
4039import java .util .List ;
@@ -88,38 +87,32 @@ public void init() {
8887 sageMakerService = new SageMakerService (modelBuilder , client , schemas , threadPool );
8988 }
9089
91- @ Test
9290 public void testSupportedTaskTypes () {
9391 sageMakerService .supportedTaskTypes ();
9492 verify (schemas , only ()).supportedTaskTypes ();
9593 }
9694
97- @ Test
9895 public void testSupportedStreamingTasks () {
9996 sageMakerService .supportedStreamingTasks ();
10097 verify (schemas , only ()).supportedStreamingTasks ();
10198 }
10299
103- @ Test
104100 public void testParseRequestConfig () {
105101 sageMakerService .parseRequestConfig ("modelId" , TaskType .ANY , Map .of (), assertNoFailureListener (model -> {
106102 verify (modelBuilder , only ()).fromRequest (eq ("modelId" ), eq (TaskType .ANY ), eq (SageMakerService .NAME ), eq (Map .of ()));
107103 }));
108104 }
109105
110- @ Test
111106 public void testParsePersistedConfigWithSecrets () {
112107 sageMakerService .parsePersistedConfigWithSecrets ("modelId" , TaskType .ANY , Map .of (), Map .of ());
113108 verify (modelBuilder , only ()).fromStorage (eq ("modelId" ), eq (TaskType .ANY ), eq (SageMakerService .NAME ), eq (Map .of ()), eq (Map .of ()));
114109 }
115110
116- @ Test
117111 public void testParsePersistedConfig () {
118112 sageMakerService .parsePersistedConfig ("modelId" , TaskType .ANY , Map .of ());
119113 verify (modelBuilder , only ()).fromStorage (eq ("modelId" ), eq (TaskType .ANY ), eq (SageMakerService .NAME ), eq (Map .of ()), eq (null ));
120114 }
121115
122- @ Test
123116 public void testInferWithWrongModel () {
124117 sageMakerService .infer (
125118 mockUnsupportedModel (),
@@ -158,7 +151,6 @@ private static <T> ActionListener<T> assertUnsupportedModel() {
158151 });
159152 }
160153
161- @ Test
162154 public void testInfer () {
163155 var model = mockModel ();
164156
@@ -213,7 +205,6 @@ private static SageMakerInferenceRequest assertRequest() {
213205 });
214206 }
215207
216- @ Test
217208 public void testInferStream () {
218209 SageMakerModel model = mockModel ();
219210
@@ -240,7 +231,6 @@ private void mockInvokeStream() {
240231 }).when (client ).invokeStream (any (), any (), any (), any ());
241232 }
242233
243- @ Test
244234 public void testInferError () {
245235 SageMakerModel model = mockModel ();
246236
@@ -277,7 +267,6 @@ private void mockInvokeFailure(Exception e) {
277267 }).when (client ).invoke (any (), any (), any (), any ());
278268 }
279269
280- @ Test
281270 public void testInferException () {
282271 SageMakerModel model = mockModel ();
283272 when (model .getInferenceEntityId ()).thenReturn ("some id" );
@@ -297,7 +286,6 @@ public void testInferException() {
297286 verifyNoMoreInteractions (client , schemas , schema );
298287 }
299288
300- @ Test
301289 public void testUnifiedInferWithWrongModel () {
302290 sageMakerService .unifiedCompletionInfer (
303291 mockUnsupportedModel (),
@@ -307,7 +295,6 @@ public void testUnifiedInferWithWrongModel() {
307295 );
308296 }
309297
310- @ Test
311298 public void testUnifiedInfer () {
312299 var model = mockModel ();
313300
@@ -329,7 +316,6 @@ public void testUnifiedInfer() {
329316 verifyNoMoreInteractions (client , schemas , schema );
330317 }
331318
332- @ Test
333319 public void testUnifiedInferError () {
334320 var model = mockModel ();
335321
@@ -360,7 +346,6 @@ private void mockInvokeStreamFailure(Exception e) {
360346 }).when (client ).invokeStream (any (), any (), any (), any ());
361347 }
362348
363- @ Test
364349 public void testUnifiedInferException () {
365350 SageMakerModel model = mockModel ();
366351 when (model .getInferenceEntityId ()).thenReturn ("some id" );
@@ -380,7 +365,6 @@ public void testUnifiedInferException() {
380365 verifyNoMoreInteractions (client , schemas , schema );
381366 }
382367
383- @ Test
384368 public void testChunkedInferWithWrongModel () {
385369 sageMakerService .chunkedInfer (
386370 mockUnsupportedModel (),
@@ -393,7 +377,6 @@ public void testChunkedInferWithWrongModel() {
393377 );
394378 }
395379
396- @ Test
397380 public void testChunkedInfer () throws Exception {
398381 var model = mockModelForChunking ();
399382
@@ -442,7 +425,6 @@ private static SageMakerInferenceRequest assertChunkRequest(Set<String> expected
442425 });
443426 }
444427
445- @ Test
446428 public void testChunkedInferError () {
447429 var model = mockModelForChunking ();
448430
@@ -473,7 +455,6 @@ public void testChunkedInferError() {
473455 verifyNoMoreInteractions (client , schemas , schema );
474456 }
475457
476- @ Test
477458 public void testClose () throws IOException {
478459 sageMakerService .close ();
479460 verify (client , only ()).close ();
0 commit comments