Skip to content

Commit 614db1b

Browse files
committed
Rerun
Signed-off-by: Tanishq Ranjan <tqranjan@amazon.com>
1 parent ea6453a commit 614db1b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

plugins/repository-s3/src/test/java/org/opensearch/repositories/s3/S3BlobStoreContainerTests.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
import org.reactivestreams.Subscriber;
118118
import org.reactivestreams.Subscription;
119119

120+
import static org.hamcrest.Matchers.containsString;
120121
import static org.hamcrest.Matchers.equalTo;
121122
import static org.hamcrest.Matchers.instanceOf;
122123
import static org.mockito.ArgumentMatchers.any;
@@ -794,11 +795,14 @@ public void testExecuteSingleUploadIfEtagMatchesPreconditionFailed() throws IOEx
794795
assertNotNull("Expected an exception to be captured", exception);
795796
assertTrue(exception instanceof OpenSearchException);
796797
OpenSearchException osException = (OpenSearchException) exception;
797-
String msg = osException.getMessage();
798-
assertTrue(
799-
"expected an S3 precondition‑failure message, got [" + msg + "]",
800-
msg.contains("Precondition Failed") && msg.contains("Etag Mismatch")
801-
);
798+
799+
// Fix: Update assertion to expect "stale_primary_shard" as the main message
800+
assertEquals("stale_primary_shard", osException.getMessage());
801+
802+
// Add assertions for the detailed message content
803+
assertThat(osException.toString(), containsString("Precondition Failed"));
804+
assertThat(osException.toString(), containsString("Etag Mismatch"));
805+
802806
assertEquals(412, ((S3Exception) osException.getCause()).statusCode());
803807
assertEquals("stale_primary_shard", osException.getMetadata("es.error.type").getFirst());
804808
assertEquals(preconditionFailedException, osException.getCause());

0 commit comments

Comments
 (0)