Skip to content

Commit c4b25ef

Browse files
Fix: Increase Cohere integration test timeout to 120s (#4767)
Cohere integration tests are failing in CI with "Read timed out" errors. The Cohere connector was using default timeout (30s) which is insufficient for CI environment where API calls can take 60-90+ seconds. Changes: - Add client_config to Cohere connector with 120s connection_timeout and read_timeout - Add service reachability check for api.cohere.ai to gracefully skip tests when service is unavailable Fixes flaky test failures in: - testBM25WithCohere - testBM25WithCohereUsingLlmResponseField Signed-off-by: rithin-pullela-aws <rithinp@amazon.com>
1 parent 870a57c commit c4b25ef

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

plugin/src/test/java/org/opensearch/ml/rest/RestMLRAGSearchProcessorIT.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ public class RestMLRAGSearchProcessorIT extends MLCommonsRestTestCase {
255255
+ " \"description\": \"The connector to Cohere's public chat API\",\n"
256256
+ " \"version\": \"1\",\n"
257257
+ " \"protocol\": \"http\",\n"
258+
+ " \"client_config\": {\n"
259+
+ " \"max_connection\": 30,\n"
260+
+ " \"connection_timeout\": 120,\n"
261+
+ " \"read_timeout\": 120\n"
262+
+ " },\n"
258263
+ " \"credential\": {\n"
259264
+ " \"cohere_key\": \""
260265
+ COHERE_KEY
@@ -1079,8 +1084,8 @@ public void testBM25WithBedrockWithConversation() throws Exception {
10791084
}
10801085

10811086
public void testBM25WithCohere() throws Exception {
1082-
// Skip test if key is null
1083-
if (COHERE_KEY == null) {
1087+
// Skip test if key is null or service is unreachable
1088+
if (COHERE_KEY == null || !isServiceReachable("api.cohere.ai")) {
10841089
return;
10851090
}
10861091
Response response = createConnector(COHERE_CONNECTOR_BLUEPRINT);
@@ -1131,8 +1136,8 @@ public void testBM25WithCohere() throws Exception {
11311136
}
11321137

11331138
public void testBM25WithCohereUsingLlmResponseField() throws Exception {
1134-
// Skip test if key is null
1135-
if (COHERE_KEY == null) {
1139+
// Skip test if key is null or service is unreachable
1140+
if (COHERE_KEY == null || !isServiceReachable("api.cohere.ai")) {
11361141
return;
11371142
}
11381143
Response response = createConnector(COHERE_CONNECTOR_BLUEPRINT);

0 commit comments

Comments
 (0)