Skip to content

Commit

Permalink
Enable test-fixture test suites
Browse files Browse the repository at this point in the history
Today the `:test:fixtures` modules' test suites are disabled, but in
fact these fixtures do have nontrivial behaviour that wants testing in
its own right, so we should run their tests.

This commit reinstates the disabled tests and fixes one which should
have been fixed as part of elastic#116212.
  • Loading branch information
DaveCTurner committed Nov 22, 2024
1 parent bcb29b7 commit e696bb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 0 additions & 9 deletions test/fixtures/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@

subprojects {
// fixtures don't have tests, these are external projects used by the build
pluginManager.withPlugin('java') {
tasks.named('test').configure {
enabled = false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import java.util.List;
import java.util.Objects;

import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.greaterThan;

public class S3HttpHandlerTests extends ESTestCase {
Expand Down Expand Up @@ -261,7 +263,7 @@ public void testListAndAbortMultipartUpload() {
<Delimiter /><Prefix>path/blob</Prefix><MaxUploads>10000</MaxUploads><IsTruncated>false</IsTruncated>\
</ListMultipartUploadsResult>"""), handleRequest(handler, "GET", "/bucket/?uploads&prefix=path/blob"));

assertEquals(RestStatus.NOT_FOUND, handleRequest(handler, "POST", "/bucket/path/blob?uploadId=" + uploadId, Strings.format("""
final var completeUploadResponse = handleRequest(handler, "POST", "/bucket/path/blob?uploadId=" + uploadId, Strings.format("""
<?xml version="1.0" encoding="UTF-8"?>
<CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Part>
Expand All @@ -272,7 +274,13 @@ public void testListAndAbortMultipartUpload() {
<ETag>%s</ETag>
<PartNumber>2</PartNumber>
</Part>
</CompleteMultipartUpload>""", part1Etag, part2Etag)).status());
</CompleteMultipartUpload>""", part1Etag, part2Etag));
if (completeUploadResponse.status() == RestStatus.OK) {
// possible, but rare, indicating that S3 started processing the upload before returning an error
assertThat(completeUploadResponse.body().utf8ToString(), allOf(containsString("<Error>"), containsString("NoSuchUpload")));
} else {
assertEquals(RestStatus.NOT_FOUND, completeUploadResponse.status());
}
}

private static String getUploadId(BytesReference createUploadResponseBody) {
Expand Down

0 comments on commit e696bb7

Please sign in to comment.