Skip to content

Commit

Permalink
Ignore all content-type checks in functional tests (minio#688)
Browse files Browse the repository at this point in the history
PR addresses all situations to avoid consistency issues
with AWS S3.
  • Loading branch information
kannappanr authored and nitisht committed Jul 5, 2018
1 parent fc80c70 commit 6e2741d
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions functional/FunctionalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public class FunctionalTest {
private static final int MB = 1024 * 1024;
private static final Random random = new Random(new SecureRandom().nextLong());
private static final String customContentType = "application/javascript";
private static final String defaultType = "application/octet-stream";
private static final String nullContentType = null;
private static String bucketName = getRandomName();
private static boolean mintEnv = false;
Expand Down Expand Up @@ -464,11 +463,6 @@ public static void putObject_test3() throws Exception {
String filename = createFile1Mb();
client.putObject(bucketName, filename, filename, customContentType);
Files.delete(Paths.get(filename));
ObjectStat objectStat = client.statObject(bucketName, filename);
if ((!customContentType.equals(objectStat.contentType())) && (!defaultType.equals(objectStat.contentType()))) {
throw new Exception("content type mismatch, expected: " + customContentType + ", got: "
+ objectStat.contentType());
}
client.removeObject(bucketName, filename);
mintSuccessLog("putObject(String bucketName, String objectName, String filename, String contentType)",
"contentType: " + customContentType, startTime);
Expand All @@ -495,13 +489,8 @@ public static void putObject_test4() throws Exception {
try (final InputStream is = new ContentInputStream(1 * MB)) {
client.putObject(bucketName, objectName, is, 1 * MB, customContentType);
}
ObjectStat objectStat = client.statObject(bucketName, objectName);
if ((!customContentType.equals(objectStat.contentType())) && (!defaultType.equals(objectStat.contentType()))) {
throw new Exception("content type mismatch, expected: " + customContentType + ", got: "
+ objectStat.contentType());
}
client.removeObject(bucketName, objectName);

client.removeObject(bucketName, objectName);
mintSuccessLog("putObject(String bucketName, String objectName, InputStream body, long size,"
+ " String contentType)",
"size: 1 MB, objectName: " + customContentType, startTime);
Expand Down Expand Up @@ -594,11 +583,7 @@ public static void testPutObjectUnknownStreamSize(long size) throws Exception {
try (final InputStream is = new ContentInputStream(size)) {
client.putObject(bucketName, objectName, is, customContentType);
}
ObjectStat objectStat = client.statObject(bucketName, objectName);
if ((!customContentType.equals(objectStat.contentType())) && (!defaultType.equals(objectStat.contentType()))) {
throw new Exception("content type mismatch, expected: " + customContentType + ", got: "
+ objectStat.contentType());
}

client.removeObject(bucketName, objectName);

mintSuccessLog("putObject(String bucketName, String objectName, InputStream body, String contentType)",
Expand Down Expand Up @@ -712,11 +697,6 @@ public static void putObject_test11() throws Exception {
client.putObject(bucketName, objectName, is, 13 * MB, headerMap);
}

ObjectStat objectStat = client.statObject(bucketName, objectName);
if ((!customContentType.equals(objectStat.contentType())) && (!defaultType.equals(objectStat.contentType()))) {
throw new Exception("content type mismatch, expected: " + customContentType + ", got: "
+ objectStat.contentType());
}
client.removeObject(bucketName, objectName);

mintSuccessLog("putObject(String bucketName, String objectName, InputStream stream, "
Expand Down Expand Up @@ -753,10 +733,6 @@ public static void putObject_test12() throws Exception {
}

ObjectStat objectStat = client.statObject(bucketName, objectName);
if ((!customContentType.equals(objectStat.contentType())) && (!defaultType.equals(objectStat.contentType()))) {
throw new Exception("content type mismatch, expected: " + customContentType + ", got: "
+ objectStat.contentType());
}
Map<String, List<String>> returnHeader = objectStat.httpHeaders();
List<String> returnStorageClass = returnHeader.get("X-Amz-Storage-Class");

Expand Down Expand Up @@ -802,10 +778,7 @@ public static void putObject_test13() throws Exception {
}

ObjectStat objectStat = client.statObject(bucketName, objectName);
if ((!customContentType.equals(objectStat.contentType())) && (!defaultType.equals(objectStat.contentType()))) {
throw new Exception("content type mismatch, expected: " + customContentType + ", got: "
+ objectStat.contentType());
}

Map<String, List<String>> returnHeader = objectStat.httpHeaders();
List<String> returnStorageClass = returnHeader.get("X-Amz-Storage-Class");

Expand Down

0 comments on commit 6e2741d

Please sign in to comment.