适用于集成测试的AWS S3本地服务器 [英] AWS S3 local server for integration testing

查看:504
本文介绍了适用于集成测试的AWS S3本地服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代码可以使用AWS S3(使用Java AWS开发工具包)上传和下载文件.我想能够为此编写一些测试,我想知道是否有人有什么好的选择.理想情况下,我希望在本地运行的轻量级S3服务器可以快速启动并且不需要系统配置(测试需要由Jenkins运行).

I have some code that uploads and downloads files using AWS S3 (using the Java AWS SDK). I want to be able to write some tests for it, I was wondering if anyone has any good options. Ideally I would like a light-weight S3 server that runs locally that can be started fast and requires no system configuration (the tests need to be run by Jenkins).

到目前为止,我已经研究了一些选项:

Some options I have looked at so far:

  1. FakeS3 -但是,当使用Java AWS开发工具包,您必须编辑/etc/hosts文件并重新启动网络连接,这是我在Jenkins中无法做到的.同样,在尝试时,似乎还有一个错误,即创建日期字段的格式设置错误,这使我的客户抛出了异常,这并没有激发我对该项目的信心.
  2. Ceph -实现S3 API,但需要花费几分钟的时间来安装
  1. FakeS3 - Almost exactly what I'm looking for, however, when using the Java AWS SDK, you must edit your /etc/hosts file and restart networking, not something I can do in Jenkins. Also when trying it out there seems to be a bug with the creation date field being formatted wrong which makes my client throw an exception, which doesn't inspire me with much confidence in the project.
  2. Ceph - Implements S3 API but takes several minutes to install

推荐答案

最新答案,主要对Docker用户有用.有一个很棒的与S3兼容的存储软件,叫做 Riak CS ,还有一个

Late answer, will be useful mostly for Docker users. There's a great S3 compatible storage software called Riak CS and there's docker-riak-cs image that allows to quickly launch the server.

我已经将它用于本地开发和集成测试近两年了,并取得了巨大的成功.它有一些局限性,但没有什么大碍之处,请参阅api/兼容性文档.

I've been using it for nearly 2 years for local development and integration testing with great success. It has some limitations, but nothing major that comes in the way, see api / compatibility documentation.

如果您需要无Docker的解决方案,则可以在本地为每个构建版本进行设置,所有设置和配置脚本均位于 docker-riak-cs 存储库.

If you need Docker-less solution, you can set it up locally for each build, all setup and configuration scripts are available in docker-riak-cs repository.

这篇关于适用于集成测试的AWS S3本地服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆