Git Product home page Git Product logo

Comments (6)

afranken avatar afranken commented on May 26, 2024

related to #536

from s3mock.

afranken avatar afranken commented on May 26, 2024

@campidelli
Do you have a working test case against the real S3 API?
When I was implementing #536, I couldn't figure out how the parts are supposed to work. Citing myself:

The implementation for the "HeadObject" attributes is straightforward, but I struggle to understand how the "ListParts" attributes are supposed to work.

I can't get a test case against the S3 API to work.
There is no way to pass in an "uploadId", so a call to an object where the multipart upload is still running returns a 404 key not found.
After the multipart upload is completed, the "parts" in the response are empty because there are no more parts.

from s3mock.

campidelli avatar campidelli commented on May 26, 2024

This is a use case https://github.com/campidelli/file-storage-service/blob/main/src/main/java/campidelli/file/storage/controller/AsyncMultipartDownloadController.java

BTW, I have found more things in this new version:

  1. Now I need to provide basic credentials to my S3Client, the DefaultCredentialsProvider doesn't work anymore.
  2. When I use .withVolumeAsRoot(TEMP_DIR.getAbsolutePath()) it times out looking for /favicon.ico and the test doesn't run.

from s3mock.

afranken avatar afranken commented on May 26, 2024

@campidelli just to reiterate:
this application and the tests are working as-is against the real S3 backend?
After looking at the code, I'm pretty sure they will not.

There are multiple problems with the test setup, none have anything to do with S3Mock:

  • The application can't reach the S3Mock testcontainer.
  • The WebTestClient request timeout is so low (5 seconds) that if the application can reach S3(Mock) and makes multiple requests, we run into timeouts.
  • The file uploaded is so small that the S3Client uses a "putObject" instead of a MultipartUpload.
  • The part size calculation is wrong, object size is always returned in bytes, so parts are expected to be 8 bytes long in your implementation.
  • Since MultipartUpload is not used, getObjectAttributes returns all needed properties in the response.
    ...

Please make sure that your code works before asking me to debug problems in S3Mock. I'm doing this in my free time... ;)

Also: run S3Mock as an external process / Docker container to see the logs. Make sure to use the "debug" setting. You can see which requests come in, which controller methods they are being routed to etc. Using "trace" gives even more output, though that may be hard to read - Spring logs a lot on "trace".
You'd have seen that there are no errors in the logs, getObjectAttributes is never called and the problem is within your test and application.

campidelli/file-storage-service#3

from s3mock.

afranken avatar afranken commented on May 26, 2024

Also:
DefaultCredentialsProvider is provided by the AWS SDK. In your test application, I can see in the debugger that DefaultCredentialsProvider is used and works, and withVolumeAsRoot does not throw an error when used.
Not sure how you can reproduce these problems.

This is a use case https://github.com/campidelli/file-storage-service/blob/main/src/main/java/campidelli/file/storage/controller/AsyncMultipartDownloadController.java

BTW, I have found more things in this new version:

1. Now I need to provide basic credentials to my S3Client, the `DefaultCredentialsProvider` doesn't work anymore.

2. When I use `.withVolumeAsRoot(TEMP_DIR.getAbsolutePath())` it times out looking for `/favicon.ico` and the test doesn't run.

from s3mock.

afranken avatar afranken commented on May 26, 2024

@campidelli I'll close this ticket.
If you have any more questions / challenges then re-open or open a new issue with a reproducer I can easily execute :)

from s3mock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.