问题是,我想编写一些测试,检查用config选项retries=dict(max_attempts=10)
创建的s3客户机在引发异常之前是否真的尝试了10次。但我不太明白怎么做。你知道吗
我已经使用了mock_s3,并尝试了monkeypatching需要s3方法的moto_服务器,但没有任何成功。你知道吗
第一次运行moto\ U服务器
moto_server s3 --port 4567
def test_delete():
client = boto3.client("s3", config=Config(retries=dict(max_attempts=10)), endpoint_url="http://localhost:4567")
client.create_bukect(Bucket="bucket_name")
client.put_object(Bucket="bucket_name", Key="file_name", Body="file_content".encode("utf-8"))
client.delete_object(Bucket="bucket_name", Key="wrong_file_name")
我希望在运行moto服务器的控制台中收到10条关于错误文件名的记录。有没有正确的测试重试的方法你能分享一下你的想法吗?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐