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

S3 Multipart Uploads #7

Closed
lucian1900 opened this issue Mar 26, 2013 · 11 comments · Fixed by #64
Closed

S3 Multipart Uploads #7

lucian1900 opened this issue Mar 26, 2013 · 11 comments · Fixed by #64

Comments

@lucian1900
Copy link
Contributor

I've started working on this at https://github.com/lucian1900/moto, I figured perhaps it should be tracked here?

@spulec
Copy link
Collaborator

spulec commented Mar 26, 2013

Awesome.

@lucian1900
Copy link
Contributor Author

Ugh, mystery parsing errors. This boto mocking business is hard to debug :)

Traceback (most recent call last):
  File "/Users/Lucian/.virtualenvs/moto/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/Lucian/Prog/moto/moto/core/models.py", line 47, in wrapper
    result = func(*args, **kwargs)
  File "/Users/Lucian/Prog/moto/tests/test_s3/test_s3.py", line 49, in test_multipart_upload
    multipart.complete_upload().should.throw(S3ResponseError)
  File "/Users/Lucian/.virtualenvs/moto/lib/python2.7/site-packages/boto/s3/multipart.py", line 302, in complete_upload
    xml = self.to_xml()
  File "/Users/Lucian/.virtualenvs/moto/lib/python2.7/site-packages/boto/s3/multipart.py", line 156, in to_xml
    for part in self:
  File "/Users/Lucian/.virtualenvs/moto/lib/python2.7/site-packages/boto/s3/multipart.py", line 121, in part_lister
    parts = mpupload.get_all_parts(None, part_number_marker)
  File "/Users/Lucian/.virtualenvs/moto/lib/python2.7/site-packages/boto/s3/multipart.py", line 222, in get_all_parts
    xml.sax.parseString(body, h)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/__init__.py", line 49, in parseString
    parser.parse(inpsrc)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/xmlreader.py", line 125, in parse
    self.close()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/expatreader.py", line 217, in close
    self.feed("", isFinal = 1)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/expatreader.py", line 211, in feed
    self._err_handler.fatalError(exc)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/handler.py", line 38, in fatalError
    raise exception
SAXParseException: <unknown>:1:0: syntax error

@spulec
Copy link
Collaborator

spulec commented Mar 30, 2013

Yeah, I'm constantly dropping pdbs inside of boto.

The problem here looks like we need to change the key GET response to return a XML response if there is an 'uploadId' in the querystring. See here. Right now it is returning the value of the key, but boto is trying to parse it as XML.

@lucian1900
Copy link
Contributor Author

Hmm, I was hoping I'd get away with not implementing part listing.

@kouk
Copy link
Collaborator

kouk commented Sep 30, 2013

Hey, just wanted to inform you that I will attempt to continue the work by @lucian1900 here: https://github.com/kouk/moto. So far I just merged all the recent development in @spulec's repo and resolved conflicts so that now we are again right where we were with the previous comments in this issue. Now, to implement part listing... :-)

@lucian1900
Copy link
Contributor Author

Oh, sorry about that :(

I no longer needed to test multipart uploads, so I gave up on this. I'm so sorry I forgot to say anything about that.

@kouk
Copy link
Collaborator

kouk commented Sep 30, 2013

No problem. Thanks for your work!

@kouk
Copy link
Collaborator

kouk commented Sep 30, 2013

I have made some progress but I am facing two problems:

  1. the test_multipart_upload tries to upload a smaller than allowed file. The API should throw a S3ResponseError. I believe I have done what is necessary for the mock api to do this and indeed I see an S3ResponseError being raised. However the test fails rather than succeeds and I don't know why.
  2. with the current version of HTTPPretty the tests fail because of this issue: Python 2.6 POST callbacks get called twice gabrielfalcao/HTTPretty#100. The specific problem is that we cannot calculate the correct ETag for the part because HTTPretty only gives us the last 8192 bytes of data. I have commented in that issue on the workaround that I used. I do not know if it causes any other problems but for me it works and all other tests pass.

If you would like I could send you a pull request, although I would like to find a way to resolve these issues first.

@spulec
Copy link
Collaborator

spulec commented Oct 3, 2013

Got it, thanks @kouk. I know @gabrielfalcao is doing some serious work on HTTPretty today and tomorrow and is specifically looking at gabrielfalcao/HTTPretty#100.

@spulec
Copy link
Collaborator

spulec commented Nov 8, 2013

Let me know if there is anything I can do to help on this. I know a large refactor of HTTPretty has been completed. May be worth it to open the pull request so others can start reviewing/helping.

@kouk
Copy link
Collaborator

kouk commented Nov 14, 2013

with some help from @attili I think we now have completed the work that @lucian1900 started. All tests pass and it's synced with your master branch.

mikegrima pushed a commit that referenced this issue Oct 14, 2019
spulec pushed a commit that referenced this issue Mar 7, 2020
pull latest upstream changes
bblommers added a commit that referenced this issue Jul 26, 2021
* fix OPTIONS requests on non-existing API GW integrations

* add cloudformation models for API Gateway deployments

* bump version

* add backdoor to return CloudWatch metrics

* Updating implementation coverage

* Updating implementation coverage

* add cloudformation models for API Gateway deployments

* Updating implementation coverage

* Updating implementation coverage

* Implemented get-caller-identity returning real data depending on the access key used.

* bump version

* minor fixes

* fix Number data_type for SQS message attribute

* fix handling of encoding errors

* bump version

* make CF stack queryable before starting to initialize its resources

* bump version

* fix integration_method for API GW method integrations

* fix undefined status in CF FakeStack

* Fix apigateway issues with terraform v0.12.21
* resource_methods -> add handle for "DELETE" method
* integrations -> fix issue that "httpMethod" wasn't included in body request (this value was set as the value from refer method resource)

* bump version

* Fix setting http method for API gateway integrations (#6)

* bump version

* remove duplicate methods

* add storage class to S3 Key when completing multipart upload (#7)

* fix SQS performance issues; bump version

* add pagination to SecretsManager list-secrets (#9)

* fix default parameter groups in RDS

* fix adding S3 metadata headers with names containing dots (#13)

* Updating implementation coverage

* Updating implementation coverage

* add cloudformation models for API Gateway deployments

* Updating implementation coverage

* Updating implementation coverage

* Implemented get-caller-identity returning real data depending on the access key used.

* make CF stack queryable before starting to initialize its resources

* bump version

* remove duplicate methods

* fix adding S3 metadata headers with names containing dots (#13)

* Update amis.json to support EKS AMI mocks (#15)

* fix PascalCase for boolean value in ListMultipartUploads response (#17); fix _get_multi_param to parse nested list/dict query params

* determine non-zero container exit code in Batch API

* support filtering by dimensions in CW get_metric_statistics

* fix storing attributes for ELBv2 Route entities; API GW refactorings for TF tests

* add missing fields for API GW resources

* fix error messages for Route53 (TF-compat)

* various fixes for IAM resources (tf-compat)

* minor fixes for API GW models (tf-compat)

* minor fixes for API GW responses (tf-compat)

* add s3 exception for bucket notification filter rule validation

* change the way RESTErrors generate the response body and content-type header

* fix lint errors and disable "black" syntax enforcement

* remove return type hint in RESTError.get_body

* add RESTError XML template for IAM exceptions

* add support for API GW minimumCompressionSize

* fix casing getting PrivateDnsEnabled API GW attribute

* minor fixes for error responses

* fix escaping special chars for IAM role descriptions (tf-compat)

* minor fixes and tagging support for API GW and ELB v2 (tf-compat)

* Merge branch 'master' into localstack

* add "AlarmRule" attribute to enable support for composite CloudWatch metrics

* fix recursive parsing of complex/nested query params

* bump version

* add API to delete S3 website configurations (#18)

* use dict copy to allow parallelism and avoid concurrent modification exceptions in S3

* fix precondition check for etags in S3 (#19)

* minor fix for user filtering in Cognito

* fix API Gateway error response; avoid returning empty response templates (tf-compat)

* support tags and tracingEnabled attribute for API GW stages

* fix boolean value in S3 encryption response (#20)

* fix connection arn structure

* fix api destination arn structure

* black format

* release 2.0.3.37

* fix s3 exception tests

see botocore/parsers.py:1002 where RequestId is removed from parsed

* remove python 2 from build action

* add test failure annotations in build action

* fix events test arn comparisons

* fix s3 encryption response test

* return default value "0" if EC2 availableIpAddressCount is empty

* fix extracting SecurityGroupIds for EC2 VPC endpoints

* support deleting/updating API Gateway DomainNames

* fix(events): Return empty string instead of null when no pattern is specified in EventPattern (tf-compat) (#22)

* fix logic and revert CF changes to get tests running again (#21)

* add support for EC2 customer gateway API (#25)

* add support for EC2 Transit Gateway APIs (#24)

* feat(logs): add `kmsKeyId` into `LogGroup` entity (#23)

* minor change in ELBv2 logic to fix tests

* feat(events): add APIs to describe and delete CloudWatch Events connections (#26)

* add support for EC2 transit gateway route tables (#27)

* pass transit gateway route table ID in Describe API, minor refactoring (#29)

* add support for EC2 Transit Gateway Routes (#28)

* fix region on ACM certificate import (#31)

* add support for EC2 transit gateway attachments (#30)

* add support for EC2 Transit Gateway VPN attachments (#32)

* fix account ID for logs API

* add support for DeleteOrganization API

* feat(events): store raw filter representation for CloudWatch events patterns (tf-compat) (#36)

* feat(events): add support to describe/update/delete CloudWatch API destinations (#35)

* add Cognito UpdateIdentityPool, CW Logs PutResourcePolicy

* feat(events): add support for tags in EventBus API (#38)

* fix parameter validation for Batch compute environments (tf-compat)

* revert merge conflicts in IMPLEMENTATION_COVERAGE.md

* format code using black

* restore original README; re-enable and fix CloudFormation tests

* restore tests and old logic for CF stack parameters from SSM

* parameterize RequestId/RequestID in response messages and revert related test changes

* undo LocalStack-specific adaptations

* minor fix

* Update CodeCov config to reflect removal of Py2

* undo change related to CW metric filtering; add additional test for CW metric statistics with dimensions

* Terraform - Extend whitelist of running tests

Co-authored-by: acsbendi <acsbendi28@gmail.com>
Co-authored-by: Phan Duong <duongpv@outlook.com>
Co-authored-by: Thomas Rausch <thomas@thrau.at>
Co-authored-by: Macwan Nevil <macnev2013@gmail.com>
Co-authored-by: Dominik Schubert <dominik.schubert91@gmail.com>
Co-authored-by: Gonzalo Saad <saad.gonzalo.ale@gmail.com>
Co-authored-by: Mohit Alonja <monty16597@users.noreply.github.com>
Co-authored-by: Miguel Gagliardo <migag9@gmail.com>
Co-authored-by: Bert Blommers <info@bertblommers.nl>
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 a pull request may close this issue.

3 participants