mock s3 tests
See original GitHub issueThe tests that use s3 to put/update/delete objects are prone to race conditions if the same tests are being run from multiple places (i.e. pr & push builds on travis). This leads to unexpectedly flopping tests and solving with a retry, which is a bit cumbersome. Example errors:
404 status code downloading tarball https://node-pre-gyp-tests.s3-us-west-1.amazonaws.com/app3/v0.1.0-dev.4/node-v51-linux-x64.tar.gz
In order to run tests reliably, we can mock out s3 functions and their responses and assert specific parameters were called. Let’s have a look at mock-aws-sdk-js, which uses sinon stubs.
cc @springmeyer
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (6 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
Mock S3 for integration test - DEV Community     
Create S3 mock server ... First we create a HttpHandler . It will return the content of S3 object. ... Then we start...
Read more >How to mock Amazon S3 in an integration test - Stack Overflow
It mocks the essential parts of AWS S3 API on top of local filesystem: import io.findify.s3mock.S3Mock S3Mock api = S3Mock.create(8001, ...
Read more >How to Mock AWS S3 in a Jest (Unit) Test - Nikhil
Here's a unit test for the code above using Jest. We'll be mocking S3, and asserting that S3's copyObject function gets called with...
Read more >How to Mock AWS S3 in a Jest (Unit) Test | by Nikhil Vijayan
Here's a unit test for the code above using Jest. We'll be mocking S3, and asserting that S3's copyObject function gets called with...
Read more >adobe/S3Mock: A simple mock implementation of the AWS S3 ...
S3Mock is a lightweight server that implements parts of the Amazon S3 API. It has been created to support local integration testing by...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

Ah, okay. In this case node-pre-gyp primarily uses both http and aws-sdk to interact with AWS. http for GET and aws-sdk for PUT/DELETE/LIST.
Diving into these tests has left me with some large-scale refactor desires. Opened a ticket in https://github.com/mapbox/node-pre-gyp/issues/392 to discuss this further.