|
74 | 74 | import com.google.common.collect.ImmutableList;
|
75 | 75 |
|
76 | 76 | import static org.opensearch.neuralsearch.util.TestUtils.INGEST_PIPELINE_TYPE;
|
77 |
| -import static org.opensearch.neuralsearch.util.TestUtils.MAX_TASK_RESULT_QUERY_TIME_IN_SECOND; |
| 77 | +import static org.opensearch.neuralsearch.util.TestUtils.MAX_TASK_RETRIES; |
78 | 78 | import static org.opensearch.neuralsearch.util.TestUtils.DEFAULT_TASK_RESULT_QUERY_INTERVAL_IN_MILLISECOND;
|
79 | 79 | import static org.opensearch.neuralsearch.util.TestUtils.DEFAULT_USER_AGENT;
|
80 | 80 | import static org.opensearch.neuralsearch.util.TestUtils.DEFAULT_NORMALIZATION_METHOD;
|
@@ -214,7 +214,7 @@ protected String uploadModel(final String requestBody) throws Exception {
|
214 | 214 |
|
215 | 215 | Map<String, Object> taskQueryResult = getTaskQueryResponse(taskId);
|
216 | 216 | boolean isComplete = checkComplete(taskQueryResult);
|
217 |
| - for (int i = 0; !isComplete && i < MAX_TASK_RESULT_QUERY_TIME_IN_SECOND; i++) { |
| 217 | + for (int i = 0; !isComplete && i < MAX_TASK_RETRIES; i++) { |
218 | 218 | taskQueryResult = getTaskQueryResponse(taskId);
|
219 | 219 | isComplete = checkComplete(taskQueryResult);
|
220 | 220 | Thread.sleep(DEFAULT_TASK_RESULT_QUERY_INTERVAL_IN_MILLISECOND);
|
@@ -243,12 +243,12 @@ protected void loadModel(final String modelId) throws Exception {
|
243 | 243 |
|
244 | 244 | Map<String, Object> taskQueryResult = getTaskQueryResponse(taskId);
|
245 | 245 | boolean isComplete = checkComplete(taskQueryResult);
|
246 |
| - for (int i = 0; !isComplete && i < MAX_TASK_RESULT_QUERY_TIME_IN_SECOND; i++) { |
| 246 | + for (int i = 0; !isComplete && i < MAX_TASK_RETRIES; i++) { |
247 | 247 | taskQueryResult = getTaskQueryResponse(taskId);
|
248 | 248 | isComplete = checkComplete(taskQueryResult);
|
249 | 249 | Thread.sleep(DEFAULT_TASK_RESULT_QUERY_INTERVAL_IN_MILLISECOND);
|
250 | 250 | }
|
251 |
| - assertTrue(isComplete); |
| 251 | + assertTrue(String.format(Locale.ROOT, "failed to load the model, last task finished with status %s", taskQueryResult.get("state")), isComplete); |
252 | 252 | }
|
253 | 253 |
|
254 | 254 | /**
|
|
0 commit comments