mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-05 20:42:54 +00:00
S3 restore test: Use a workaround to enable moto's self-copy support (#6594)
While working on https://github.com/getmoto/moto/pull/7303 I discovered that if you enable bucket encryption, moto allows self-copies. So we can un-ignore the test. I tried it out locally, it works great. Followup of #6533, part of https://github.com/neondatabase/cloud/issues/8233
This commit is contained in:
@@ -356,10 +356,26 @@ def enable_remote_storage_versioning(
|
||||
"""
|
||||
Enable S3 versioning for the remote storage
|
||||
"""
|
||||
# local_fs has no
|
||||
# local_fs has no support for versioning
|
||||
assert isinstance(remote, S3Storage), "localfs is currently not supported"
|
||||
assert remote.client is not None
|
||||
|
||||
# The SDK supports enabling versioning on normal S3 as well but we don't want to change
|
||||
# these settings from a test in a live bucket (also, our access isn't enough nor should it be)
|
||||
assert not remote.real, "Enabling storage versioning only supported on Mock S3"
|
||||
|
||||
# Workaround to enable self-copy until upstream bug is fixed: https://github.com/getmoto/moto/issues/7300
|
||||
remote.client.put_bucket_encryption(
|
||||
Bucket=remote.bucket_name,
|
||||
ServerSideEncryptionConfiguration={
|
||||
"Rules": [
|
||||
{
|
||||
"ApplyServerSideEncryptionByDefault": {"SSEAlgorithm": "AES256"},
|
||||
"BucketKeyEnabled": False,
|
||||
},
|
||||
]
|
||||
},
|
||||
)
|
||||
# Note that this doesnt use pagination, so list is not guaranteed to be exhaustive.
|
||||
response = remote.client.put_bucket_versioning(
|
||||
Bucket=remote.bucket_name,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import time
|
||||
from datetime import datetime, timezone
|
||||
|
||||
import pytest
|
||||
from fixtures.neon_fixtures import (
|
||||
NeonEnvBuilder,
|
||||
PgBin,
|
||||
@@ -32,7 +31,6 @@ def test_tenant_s3_restore(
|
||||
remote_storage = neon_env_builder.pageserver_remote_storage
|
||||
assert remote_storage, "remote storage not configured"
|
||||
enable_remote_storage_versioning(remote_storage)
|
||||
pytest.skip("moto doesn't support self-copy: https://github.com/getmoto/moto/issues/7300")
|
||||
|
||||
env = neon_env_builder.init_start(initial_tenant_conf=MANY_SMALL_LAYERS_TENANT_CONFIG)
|
||||
env.pageserver.allowed_errors.extend(
|
||||
|
||||
Reference in New Issue
Block a user