Skip to content

Commit 0944e06

Browse files
committed
Enable test-fixture test suites (elastic#117329)
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.
1 parent e0e96a1 commit 0944e06

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

test/fixtures/build.gradle

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
2-
subprojects {
3-
// fixtures don't have tests, these are external projects used by the build
4-
pluginManager.withPlugin('java') {
5-
tasks.named('test').configure {
6-
enabled = false
7-
}
8-
}
9-
}

test/fixtures/s3-fixture/src/test/java/fixture/s3/S3HttpHandlerTests.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import java.util.List;
3232
import java.util.Objects;
3333

34+
import static org.hamcrest.Matchers.allOf;
35+
import static org.hamcrest.Matchers.containsString;
3436
import static org.hamcrest.Matchers.greaterThan;
3537

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

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

278286
private static String getUploadId(BytesReference createUploadResponseBody) {

0 commit comments

Comments
 (0)