Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for re-created bucket and bucket policy #104

Merged
merged 1 commit into from
Jul 28, 2017

Conversation

krisis
Copy link
Member

@krisis krisis commented Jul 24, 2017

Regression test for minio/minio#4714

$params = [
'404' => ['Bucket' => $bucket]
];
runExceptionalTests($s3Client, 'getBucketPolicy', 'getStatusCode', $params);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runExceptionalTests() ? what is the gist behind Exceptional ? is it to indicate Exceptions being generated by these tests?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the test catching 404? we should catch 403 instead after creating the bucket. To ensure completely that the policy is not in effect.

Copy link
Member Author

@krisis krisis Jul 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the test catching 404? we should catch 403 instead after creating the bucket. To ensure completely that the policy is not in effect.

@harshavardhana Yes, the test is looking for NoSuchBucketPolicy. Are you suggesting that I also check that anonymous GET request fails with 403? I can add that too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runExceptionalTests() ? what is the gist behind Exceptional ? is it to indicate Exceptions being generated by these tests?
@harshavardhana the function has the following comments in code, let me know how we can change it to make it more useful.

 /**
  * runExceptionalTests executes a collection of tests that will throw
  * a known exception.
  *
  * @param $s3Client AWS\S3\S3Client object
  *
  * @param $apiCall Name of the S3Client API method to call
  *
  * @param $exceptionMatcher Name of Aws\S3\Exception\S3Exception
  * method to fetch exception details
  *
  * @param $exceptionParamMap Associative array of exception names to
  * API parameters. E.g,
  * $apiCall = 'headBucket'
  * $exceptionMatcher = 'getStatusCode'
  * $exceptionParamMap = [
  * // Invalid bucket name
  *     '400' => ['Bucket' => $bucket['Name'] . '--'],
  *
  *      // Non existent bucket
  *      '404' => ['Bucket' => $bucket['Name'] . '-non-existent'],
  * ];
  *
  * @return string - HTTP status code. E.g, "400" for Bad Request.
  */

// Create an object to test anonymous GET object
$object = 'test-anon';
if (!file_exists($MINT_DATA_DIR . '/' . FILE_10KB))
throw new Exception('File not found ' . $MINT_DATA_DIR . '/' . FILE_10KB);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we programmatically create some data if MINT_DATA_DIR variable is not specified ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess not for these . These are part of mint . It's applicable for our SDK tests.

@deekoder deekoder requested review from poornas and nitisht July 25, 2017 19:22
// Create an object to test anonymous GET object
$object = 'test-anon';
if (!file_exists($MINT_DATA_DIR . '/' . FILE_10KB))
throw new Exception('File not found ' . $MINT_DATA_DIR . '/' . FILE_10KB);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krisis, I ran your changes on docker minio/mint:latest image and the tests fail for completeMultipartUpload.
root@0bd36cddde66:/mint# cat log/aws-sdk-php/error.log
PHP Fatal error: Uncaught Exception: Expected completeMultipartUpload to fail with EntityTooSmall in /mint/run/core/aws-sdk-php/quick-tests.php:130
Stack trace:
#0 /mint/run/core/aws-sdk-php/quick-tests.php(508): runExceptionalTests(Object(Aws\S3\S3Client), 'completeMultipa...', 'getAwsErrorCode', Array)
#1 /mint/run/core/aws-sdk-php/quick-tests.php(868): testMultipartUploadFailure(Object(Aws\S3\S3Client), 'aws-sdk-php-buc...', 'obj1')
#2 /mint/run/core/aws-sdk-php/quick-tests.php(926): runTestFunction('testMultipartUp...', Object(Aws\S3\S3Client), 'aws-sdk-php-buc...', 'obj1')
#3 {main}
thrown in /mint/run/core/aws-sdk-php/quick-tests.php on line 130
root@0bd36cddde66:/mint#

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@poornas, which version of minio server did you run mint on? I tried it locally with minio commit id ec5293c and all tests passed. Previously, minio on FS mode didn't validate if parts uploaded where smaller than 5MB in a multipart upload. This was fixed recently - minio/minio#4642.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krisis, ran this against play server, it is on Version : 2017-06-24T23:30:00Z.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@poornas minio/minio#4642 is fixed in version 2017-07-24T18-27-35Z. This explains why you are seeing the exception.

Copy link
Contributor

@nitisht nitisht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested & LGTM

Copy link
Contributor

@poornas poornas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested with localhost running latest minio

@nitisht nitisht merged commit 8c0fdb3 into minio:master Jul 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants