Skip to content

Commit

Permalink
Fix SetBucketPolicy Functional test (minio#659)
Browse files Browse the repository at this point in the history
Set the time delay to 15 seconds
Set header 'x-amz-acl' to 'bucket-owner-full-control', while creating
the object anonymously, so it can be downloaded by bucket owner on AWS S3.
Ref: http://prettyplease.me/anonymous-s3-upload-with-full-owner-control/
  • Loading branch information
kannappanr authored Feb 7, 2018
1 parent 3ac8a74 commit 72b4909
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions functional/FunctionalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,12 @@ public static byte[] readObject(String urlString) throws Exception {
*/
public static void writeObject(String urlString, byte[] dataBytes) throws Exception {
Request.Builder requestBuilder = new Request.Builder();
// Set header 'x-amz-acl' to 'bucket-owner-full-control', so objects created
// anonymously, can be downloaded by bucket owner in AWS S3.
Request request = requestBuilder
.url(HttpUrl.parse(urlString))
.method("PUT", RequestBody.create(null, dataBytes))
.addHeader("x-amz-acl", "bucket-owner-full-control")
.build();
OkHttpClient transport = new OkHttpClient();
Response response = transport.newCall(request).execute();
Expand Down Expand Up @@ -2410,8 +2413,8 @@ public static void testSetBucketPolicy(String objectPrefix, PolicyType policyTyp
long startTime = System.currentTimeMillis();
try {
client.setBucketPolicy(bucketName, objectPrefix, policyType);
// Wait for 5 seconds for server to set the policy into effect.
Thread.sleep(5000);
// Wait for 15 seconds for server to set the policy into effect.
Thread.sleep(15000);

String objectName = objectPrefix + "/" + getRandomName();
String urlString = client.getObjectUrl(bucketName, objectName);
Expand Down

0 comments on commit 72b4909

Please sign in to comment.