Skip to content
forked from adobe/S3Mock

A simple mock implementation of the AWS S3 API startable as Docker image or JUnit rule

License

Notifications You must be signed in to change notification settings

DominikDary/S3Mock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

S3Mock

Introduction

S3Mock is a lightweight server that implements parts of the Amazon S3 API. It has been created to support hermetic testing and reduces the infrastructure dependencies while testing.

The mock server can be started as a Docker container or using a JUnit Rule.

Similiar projects are e.g.:

Build & Run

Run the s3 mock (adjust the port numbers as desired):

mvn clean package docker:start -Ddocker.follow -Dit.s3mock.port_http=9090 -Dit.s3mock.port_https=9191

... stop with ctrl-c.

Docker Support

Build and create the docker container:

 mvn clean package

Run the created docker container:

docker run -p 9090:9090 -p 9191:9191 -t adobe/s3mock

... stop with ctrl-c.

Configuration

The mock can be configured with the following environment parameters:

  • validKmsKeys: list of KMS Key-Refs that are to be treated as valid.
  • initialBuckets: list of names for buckets that will be available initially.

Usage

With the Docker plugin

Our integration tests are using the Amazon S3 Client to verify the server functionality against the S3Mock. During the Maven build, the Docker image is started using the docker-maven-plugin and the corresponding ports are passed to the JUnit test through the maven-failsafe-plugin. See AmazonClientUploadIT how it's used in the code.

This way, one can easily switch between calling the S3Mock or the real S3 endpoint and this doesn't add any additional Java dependencies to the project.

With the JUnit Rule

The test S3MockRuleTest demonstrates the usage of the S3MockRule. This requires the Maven artifact to be added to the project in test scope:

<dependency>
  <groupId>com.adobe.testing</groupId>
  <artifactId>s3mock</artifactId>
  <version>...</version>
  <scope>test</scope>
<dependency>

Contribution

Contributions are welcome. Please fork the project and create for your finished feature a pull request.

Out Adobe Code of Conduct applies.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

About

A simple mock implementation of the AWS S3 API startable as Docker image or JUnit rule

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%