Skip to content

Commit 556f8ee

Browse files
Fix RestChatAgentIT teardown failure when AWS credentials are absent (#4772) (#4773)
The @after deleteIndices() method runs unconditionally, even when setup() skips via Assume.assumeNotNull due to missing AWS credentials. Since iris_data was never created, the DELETE returns 404, which combines with the AssumptionViolatedException to produce a TestCouldNotBeSkippedException — turning a skip into a hard failure. Guard the teardown with the same credential check used in setup(). (cherry picked from commit 9df8682) Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> Co-authored-by: Tyler Ohlsen <ohltyler@amazon.com>
1 parent a26f87f commit 556f8ee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ public void setup() throws IOException, ParseException, InterruptedException {
6565

6666
@After
6767
public void deleteIndices() throws IOException {
68-
deleteIndexWithAdminClient(irisIndex);
68+
if (AWS_ACCESS_KEY_ID != null && AWS_SECRET_ACCESS_KEY != null) {
69+
deleteIndexWithAdminClient(irisIndex);
70+
}
6971
}
7072

7173
public void testChatAgentWithAgentTool() throws IOException {

0 commit comments

Comments
 (0)