Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Implement more ASF S3 operations in provider #6868

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

Merged
merged 2 commits into from
Sep 23, 2022
Merged

Conversation

bentsku
Copy link
Contributor

@bentsku bentsku commented Sep 13, 2022

This PR adds more operations to the S3 provider, and reorganised the tests by class, grouping them more coherently.
This will reduces the number of failing test and implement a lot of basic functionality, and fixes some current bugs at the same time.
It is a bit hard to keep track of implemented operation and fixed exceptions, as a lot of fixes are done by moto patching.

Implemented operations:

  • GetBucketRequestPayment

  • PutBucketRequestPayment

  • GetBucketLifecycleConfiguration (had to reimplement it, moto is not validating correctly Transition actions, and will raise exceptions. Would need a bigger rewrite in moto. Needed for Terraform).

  • PutBucketLifecycleConfiguration

  • DeleteBucketLifecycleConfiguration

  • fix object Expires parameter

  • fix GetObject with range headers, and return proper status code

  • fix restoring object from DEEP_ARCHIVE, raise error if trying to get an object in that state

  • fix exceptions missing in the specs, or missing members

  • implement proper DeleteResult for DeleteObjects

Also had to regenerate all s3 snapshots as the moving of tests made a lot of changes, it was simpler to regenerate everything from scratch.

Currently having unit tests failing as they are testing patched behaviour against original specs. Will need to fix this before merging. Done, seen with Alex.

Sorry this PR is quite large, subsequent PR based on this one will be smaller and implement specific things. This one was quite general.

@github-actions
Copy link

github-actions bot commented Sep 13, 2022

LocalStack integration with Pro

1 291 tests  +18   1 169 ✔️ +17   50m 12s ⏱️ + 7m 38s
       1 suites ±  0      122 💤 +  1 
       1 files   ±  0          0 ±  0 

Results for commit 73e08f0. ± Comparison against base commit 99dcb7b.

♻️ This comment has been updated with latest results.

@bentsku bentsku temporarily deployed to localstack-ext-tests September 13, 2022 22:59 Inactive
@bentsku bentsku force-pushed the s3-asf-basic-op-next branch 2 times, most recently from ddc8710 to a3f202f Compare September 14, 2022 20:39
@bentsku bentsku temporarily deployed to localstack-ext-tests September 14, 2022 20:39 Inactive
@bentsku bentsku force-pushed the s3-asf-basic-op-next branch from a3f202f to f6e0d64 Compare September 14, 2022 20:41
@bentsku bentsku temporarily deployed to localstack-ext-tests September 14, 2022 20:41 Inactive
@bentsku
Copy link
Contributor Author

bentsku commented Sep 14, 2022

Local tests results:

Once the class is fully succeeding, it won't be showed in subsequent PRs.

TestS3

/ Before After
✅ Passed 43 61
🙈 Ignored 7 8
❗ Failed 12 1
Total 62 70

TestS3TerraformRawRequests

/ Before After
✅ Passed 0 1
🙈 Ignored 0 0
❗ Failed 1 0
Total 1 1

TestS3PresignedURL

note: the succeeding ones are not validating authorisation

/ Before After
✅ Passed 11 15
🙈 Ignored 3 2
❗ Failed 14 14
Total 28 31

TestS3CORS

/ Before After
✅ Passed 4 0
🙈 Ignored 0 0
❗ Failed 10 2
Total 14 2

TestS3StorageClass

/ Before After
✅ Passed 1 2
🙈 Ignored 0 0
❗ Failed 0 0
Total 1 2

TestS3StaticWebsiteHosting

/ Before After
✅ Passed - 0
🙈 Ignored - 0
❗ Failed - 2
Total 0 2

Total

/ Before After
✅ Passed 62 79
🙈 Ignored 10 10
❗ Failed 34 19
Total 106 108

@bentsku bentsku force-pushed the s3-asf-basic-op-next branch from f6e0d64 to 58ebd39 Compare September 20, 2022 12:36
@bentsku bentsku temporarily deployed to localstack-ext-tests September 20, 2022 12:36 Inactive
@bentsku bentsku temporarily deployed to localstack-ext-tests September 20, 2022 13:36 Inactive
@bentsku bentsku force-pushed the s3-asf-basic-op-next branch from a3c4506 to 51a57c0 Compare September 20, 2022 20:53
@bentsku bentsku force-pushed the s3-asf-basic-op-next branch from 51a57c0 to 3776444 Compare September 21, 2022 12:04
@bentsku bentsku temporarily deployed to localstack-ext-tests September 21, 2022 12:04 Inactive
@bentsku bentsku marked this pull request as ready for review September 21, 2022 12:17
@bentsku bentsku changed the title WIP: Implement more ASF S3 operations in provider Implement more ASF S3 operations in provider Sep 21, 2022
@coveralls
Copy link

coveralls commented Sep 21, 2022

Coverage Status

Coverage decreased (-0.2%) to 79.85% when pulling 73e08f0 on s3-asf-basic-op-next into 99dcb7b on master.

Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

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

LGTM! great work on the provider! 💯

Comment on lines +212 to +218
{
"op": "remove",
"path": "/shapes/DeleteObjectsOutput"
},
{
"op": "add",
"path": "/shapes/DeleteResult",
Copy link
Member

Choose a reason for hiding this comment

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

question: why exactly are we replacing DeleteObjectsOutput with this new shape? looks like the botocore spec is the same https://github.com/boto/botocore/blob/4d4af71c10187a7c26b5193fb53a4ff8bc8cbfe7/botocore/data/s3/2006-03-01/service-2.json#L3200-L3218

Copy link
Contributor Author

@bentsku bentsku Sep 22, 2022

Choose a reason for hiding this comment

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

If I remember well, it's because the response is wrapped in the name of the output shape. Like <DeleteObjectOutput>response members xml</DeleteObjectOutput>.
But S3 returns <DeleteResult> instead. Not sure if I can change the name in any other way. Doesn't seem to have locationName for output shapes. Seems weird and dirty though 🤷‍♂️

@bentsku bentsku temporarily deployed to localstack-ext-tests September 22, 2022 19:52 Inactive
@bentsku bentsku merged commit cf8a254 into master Sep 23, 2022
@bentsku bentsku deleted the s3-asf-basic-op-next branch September 23, 2022 09:16
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.

3 participants