|
26 | 26 | import org.apache.http.message.BasicHeader;
|
27 | 27 | import org.junit.Before;
|
28 | 28 | import org.opensearch.client.Response;
|
| 29 | +import org.opensearch.client.ResponseException; |
29 | 30 | import org.opensearch.core.rest.RestStatus;
|
30 | 31 | import org.opensearch.ml.common.conversation.ActionConstants;
|
31 | 32 | import org.opensearch.ml.settings.MLCommonsSettings;
|
@@ -163,15 +164,20 @@ public void testDeleteConversation_WithInteractions() throws IOException {
|
163 | 164 | assert (!gcmap.containsKey("next_token"));
|
164 | 165 | assert (((ArrayList) gcmap.get("conversations")).size() == 0);
|
165 | 166 |
|
166 |
| - Response giresponse = TestHelper |
167 |
| - .makeRequest(client(), "GET", ActionConstants.GET_INTERACTIONS_REST_PATH.replace("{conversation_id}", cid), null, "", null); |
168 |
| - assert (giresponse != null); |
169 |
| - assert (TestHelper.restStatus(giresponse) == RestStatus.OK); |
170 |
| - HttpEntity gihttpEntity = giresponse.getEntity(); |
171 |
| - String gientityString = TestHelper.httpEntityToString(gihttpEntity); |
172 |
| - Map gimap = gson.fromJson(gientityString, Map.class); |
173 |
| - assert (gimap.containsKey("interactions")); |
174 |
| - assert (!gimap.containsKey("next_token")); |
175 |
| - assert (((ArrayList) gimap.get("interactions")).size() == 0); |
| 167 | + try { |
| 168 | + Response giresponse = TestHelper |
| 169 | + .makeRequest(client(), "GET", ActionConstants.GET_INTERACTIONS_REST_PATH.replace("{conversation_id}", cid), null, "", null); |
| 170 | + assert (giresponse != null); |
| 171 | + assert (TestHelper.restStatus(giresponse) == RestStatus.OK); |
| 172 | + HttpEntity gihttpEntity = giresponse.getEntity(); |
| 173 | + String gientityString = TestHelper.httpEntityToString(gihttpEntity); |
| 174 | + Map gimap = gson.fromJson(gientityString, Map.class); |
| 175 | + assert (gimap.containsKey("interactions")); |
| 176 | + assert (!gimap.containsKey("next_token")); |
| 177 | + assert (((ArrayList) gimap.get("interactions")).size() == 0); |
| 178 | + assert (false); |
| 179 | + } catch (ResponseException e) { |
| 180 | + assert (TestHelper.restStatus(e.getResponse()) == RestStatus.NOT_FOUND); |
| 181 | + } |
176 | 182 | }
|
177 | 183 | }
|
0 commit comments