Skip to content

Commit f504e35

Browse files
committed
Bogus test
1 parent 0990287 commit f504e35

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

modules/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobContainerRetriesTests.java

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
import org.apache.http.HttpStatus;
2020
import org.apache.logging.log4j.Level;
21-
import org.apache.lucene.index.CorruptIndexException;
22-
import org.apache.lucene.store.AlreadyClosedException;
2321
import org.elasticsearch.ExceptionsHelper;
2422
import org.elasticsearch.cluster.metadata.RepositoryMetadata;
2523
import org.elasticsearch.common.BackoffPolicy;
@@ -81,10 +79,8 @@
8179
import java.util.Objects;
8280
import java.util.OptionalInt;
8381
import java.util.Set;
84-
import java.util.concurrent.atomic.AtomicBoolean;
8582
import java.util.concurrent.atomic.AtomicInteger;
8683
import java.util.concurrent.atomic.AtomicLong;
87-
import java.util.concurrent.atomic.AtomicReference;
8884
import java.util.function.IntConsumer;
8985
import java.util.regex.Pattern;
9086

@@ -327,58 +323,6 @@ public void testWriteBlobWithReadTimeouts() {
327323
assertThat(exception.getCause().getCause().getMessage().toLowerCase(Locale.ROOT), containsString("read timed out"));
328324
}
329325

330-
/**
331-
* This test shows that the AWS SDKv1 defers the closing of the InputStream used to upload a blob after the HTTP request has been sent
332-
* to S3, swallowing any exception thrown at closing time.
333-
*/
334-
@AwaitsFix(bugUrl = "TODO NOMERGE")
335-
public void testWriteBlobWithExceptionThrownAtClosingTime() throws Exception {
336-
var maxRetries = randomInt(3);
337-
var blobLength = randomIntBetween(1, 4096 * 3);
338-
var blobName = getTestName().toLowerCase(Locale.ROOT);
339-
var blobContainer = createBlobContainer(maxRetries, null, true, null, null);
340-
341-
var uploadedBytes = new AtomicReference<BytesReference>();
342-
httpServer.createContext(downloadStorageEndpoint(blobContainer, blobName), exchange -> {
343-
var requestComponents = S3HttpHandler.parseRequestComponents(S3HttpHandler.getRawRequestString(exchange));
344-
if ("PUT".equals(requestComponents.method()) && requestComponents.query().isEmpty()) {
345-
var body = Streams.readFully(exchange.getRequestBody());
346-
if (uploadedBytes.compareAndSet(null, body)) {
347-
exchange.sendResponseHeaders(HttpStatus.SC_OK, -1);
348-
exchange.close();
349-
return;
350-
}
351-
}
352-
exchange.sendResponseHeaders(HttpStatus.SC_BAD_REQUEST, -1);
353-
exchange.close();
354-
});
355-
356-
final byte[] bytes = randomByteArrayOfLength(blobLength);
357-
358-
var exceptionThrown = new AtomicBoolean();
359-
blobContainer.writeBlobAtomic(randomPurpose(), blobName, new FilterInputStream(new ByteArrayInputStream(bytes)) {
360-
@Override
361-
public void close() throws IOException {
362-
if (exceptionThrown.compareAndSet(false, true)) {
363-
switch (randomInt(3)) {
364-
case 0:
365-
throw new CorruptIndexException("simulated", blobName);
366-
case 1:
367-
throw new AlreadyClosedException("simulated");
368-
case 2:
369-
throw new RuntimeException("simulated");
370-
case 3:
371-
default:
372-
throw new IOException("simulated");
373-
}
374-
}
375-
}
376-
}, blobLength, true);
377-
378-
assertThat(exceptionThrown.get(), is(true));
379-
assertArrayEquals(bytes, BytesReference.toBytes(uploadedBytes.get()));
380-
}
381-
382326
@AwaitsFix(bugUrl = "TODO NOMERGE")
383327
public void testWriteLargeBlob() throws Exception {
384328
final boolean useTimeout = rarely();

0 commit comments

Comments
 (0)