Amazon S3 独立存根服务器

发布于 2024-07-04 12:34:45 字数 191 浏览 5 评论 0 原文

我似乎记得读过有关 Amazon S3 兼容测试服务器的文章,您可以在自己的服务器上运行该服务器以进行单元测试或其他任何操作。 然而,我已经耗尽了我在 Google 和 AWS 上寻找这个的耐心。 这样的事情存在吗? 如果没有的话,我想我会写一篇。

注意:我问的是 Amazon S3(存储系统)而不是 Amazon EC2(云计算)。

I seem to recall reading about an Amazon S3-compatible test server that you could run on your own server for unit tests or whatever. However, I've just exhausted my patience looking for this with both Google and AWS. Does such a thing exist? If not, I think I'll write one.

Note: I'm asking about Amazon S3 (the storage system) rather than Amazon EC2 (cloud computing).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

不顾 2024-07-11 12:34:46

我认为 moto (https://github.com/spulec/moto) 是单元测试的完美工具。 Moto 模拟对 S3、SQS 等的所有访问,并且可以使用其 Web 服务器在任何编程语言中使用。

它的设置很简单,重量轻且快速。

来自 moto 的自述文件:

想象一下您想要测试以下代码:

import boto
from boto.s3.key import Key

class MyModel(object):
    def __init__(self, name, value):
        self.name = name
        self.value = value

    def save(self):
        conn = boto.connect_s3()
        bucket = conn.get_bucket('mybucket')
        k = Key(bucket)
        k.key = self.name
        k.set_contents_from_string(self.value)

花一点时间思考一下您过去会如何测试它。 现在看看如何使用 Moto 进行测试:

import boto
from moto import mock_s3
from mymodule import MyModel

@mock_s3
def test_my_model_save():
    model_instance = MyModel('steve', 'is awesome')
    model_instance.save()

    conn = boto.connect_s3()
    assert conn.get_bucket('mybucket').get_key('steve') == 'is awesome'

I think moto (https://github.com/spulec/moto) is the perfect tool for your unittests. Moto mocks all accesses to S3, SQS, etc. and can be used in any programming language using their web server.

It is trivial to setup, lightweight and fast.

From moto's README:

Imagine you have the following code that you want to test:

import boto
from boto.s3.key import Key

class MyModel(object):
    def __init__(self, name, value):
        self.name = name
        self.value = value

    def save(self):
        conn = boto.connect_s3()
        bucket = conn.get_bucket('mybucket')
        k = Key(bucket)
        k.key = self.name
        k.set_contents_from_string(self.value)

Take a minute to think how you would have tested that in the past. Now see how you could test it with Moto:

import boto
from moto import mock_s3
from mymodule import MyModel

@mock_s3
def test_my_model_save():
    model_instance = MyModel('steve', 'is awesome')
    model_instance.save()

    conn = boto.connect_s3()
    assert conn.get_bucket('mybucket').get_key('steve') == 'is awesome'
风启觞 2024-07-11 12:34:46

Park Place 已移至 github:
http://github.com/technoweenie/parkplace

Park Place has moved to github:
http://github.com/technoweenie/parkplace

俯瞰星空 2024-07-11 12:34:46

桉树 http://eucalyptus.cs.ucsb.edu/

EUCALYPTUS - 弹性效用计算
链接程序的架构
To Useful Systems - 是一个开源的
软件基础设施
实施“云计算”
集群。 当前界面为
EUCALYPTUS 与亚马逊兼容
EC2接口,但基础设施
旨在支持多个
客户端接口。

请注意,根据文档,Eucalypus 不仅重新实现了 EC2 接口,还重新实现了 S3 存储系统。 该存储组件称为 Walrus。 (http://open.eucalyptus.com/wiki/EucalyptusUserGuide_v1.5.2)

Eucalyptus http://eucalyptus.cs.ucsb.edu/

EUCALYPTUS - Elastic Utility Computing
Architecture for Linking Your Programs
To Useful Systems - is an open-source
software infrastructure for
implementing "cloud computing" on
clusters. The current interface to
EUCALYPTUS is compatible with Amazon's
EC2 interface, but the infrastructure
is designed to support multiple
client-side interfaces.

Note that, according to the documentation, Eucalypus includes a reimplementation not only of the EC2 interface but also the S3 storage system. That storage component is called Walrus. (http://open.eucalyptus.com/wiki/EucalyptusUserGuide_v1.5.2)

吹泡泡o 2024-07-11 12:34:46

Fake S3 似乎是 S3 的最新重新实现,专门设计用于测试。

Fake S3 appears to be an up-to-date reimplementation of S3, specifically designed for use in testing.

烧了回忆取暖 2024-07-11 12:34:46

我们遇到了在本地测试基于 S3 的代码的问题,并实际实现了一个小型 Java 服务器,该服务器模拟 S3 对象 API。 因为它可能对其他人有用,所以我们设置了一个 github 存储库以及一个小网站:http://s3ninja.net -所有开源均在 MIT 许可下。

它非常小且简单,可以在几分钟内完成设置。 (作为一个基于 SIRIUS 的应用程序,中等服务器上的启动时间不到一秒)。

We ran into the problem of testing our S3 based code locally and actually implemented a small Java server, which emulates the S3 object API. As it might be useful to others, we setup a github repo along with a small website: http://s3ninja.net - all OpenSource under the MIT license.

It's quite small and simple and can be setup in minutes. (Being a SIRIUS based application, statup on a moderate server takes less than a second).

春夜浅 2024-07-11 12:34:46

Amazon 使用 Xen,因此您可以在自己的 Xen 安装中运行 AMI。 不过,我只是启动一个实例并在那里运行测试。 它的成本并不高,而且您通常应该可以在本地进行开发,并且很少在他们的系统上进行测试。

Amazon uses Xen, so you can probably just run your AMI in your own Xen installation. I'd just fire up an instance and run the tests there, though. It doesn't cost much and you should usually be fine with developing locally and infrequently testing it on their system.

御守 2024-07-11 12:34:45

您是否正在考虑公园广场

仅供参考,其旧主页现已离线。

Are you thinking of Park Place?

FYI, its old home page is offline now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文