mirror of
https://github.com/rustfs/rustfs.git
synced 2026-11-26 18:32:42 +00:00
test(gateway): record both Ceph addressing styles in nightly runs
This commit is contained in:
@@ -19,6 +19,8 @@ ceph = [
|
||||
|
||||
[nightly_extra]
|
||||
e2e = [
|
||||
"anonymous_access_test::test_anonymous_access_allowed_when_public_access_block_missing",
|
||||
"anonymous_access_test::test_anonymous_access_allowed_when_restrict_public_buckets_disabled",
|
||||
"checksum_upload_test::tests::test_additional_checksums_verify_on_write",
|
||||
"checksum_upload_test::tests::test_crc64nvme_matches_between_put_object_and_multipart_upload",
|
||||
"checksum_upload_test::tests::test_full_object_multipart_reports_full_object_checksum_type",
|
||||
@@ -41,6 +43,7 @@ e2e = [
|
||||
"copy_object_tagging_test::tests::copy_object_applies_copy_replace_and_empty_tagging_directives",
|
||||
"copy_object_version_restore_test::tests::test_copy_of_non_latest_source_version_returns_copy_source_version_id",
|
||||
"copy_object_version_restore_test::tests::test_self_copy_of_historical_version_restores_data_and_metadata",
|
||||
"copy_source_invalid_date_test::tests::test_copy_source_if_unmodified_since_valid_and_invalid",
|
||||
"create_bucket_region_test::tests::test_create_bucket_accepts_listed_regions",
|
||||
"create_bucket_region_test::tests::test_create_bucket_duplicate_outside_default_region_reports_owned_by_you",
|
||||
"create_bucket_region_test::tests::test_create_bucket_uses_configured_region",
|
||||
@@ -51,17 +54,22 @@ e2e = [
|
||||
"delete_objects_versioning_test::tests::test_explicit_delete_marker_batch_removes_versions_without_client_retries",
|
||||
"dual_stack_differential::tests::both_stacks_answer_every_operation_identically",
|
||||
"get_object_parts_count_test::get_object_reports_parts_count_for_multipart_upload",
|
||||
"head_object_consistency_test::head_object_consistency_after_write_and_multipart_and_presigned_head",
|
||||
"head_object_range_test::head_object_advertises_accept_ranges",
|
||||
"kms::configured_roundtrip_test::test_admin_configured_local_kms_is_restored_after_restart",
|
||||
"kms::configured_roundtrip_test::test_configured_local_kms_admin_and_versioned_cleanup",
|
||||
"kms::copy_object_version_restore_sse_test::test_self_copy_of_historical_sse_s3_version_is_readable",
|
||||
"kms::encrypted_range_get_test::sse_s3_single_part_ranged_gets_are_byte_exact",
|
||||
"kms::kms_edge_cases_test::test_kms_single_byte_file_encryption",
|
||||
"kms::kms_edge_cases_test::test_kms_zero_byte_file_encryption",
|
||||
"kms::multipart_encryption_test::test_step1_basic_single_file_encryption",
|
||||
"leading_slash_key_test::tests::test_put_object_with_duplicate_slashes_normalized",
|
||||
"leading_slash_key_test::tests::test_put_object_with_leading_slash_key",
|
||||
"lifecycle_regression_test::tests::test_delete_marker_creation_and_visibility",
|
||||
"lifecycle_regression_test::tests::test_lifecycle_expiration_rule_persists_correctly",
|
||||
"lifecycle_regression_test::tests::test_lifecycle_noncurrent_version_expiration_rule_persists",
|
||||
"lifecycle_regression_test::tests::test_lifecycle_prefix_rule_persists",
|
||||
"list_buckets_iam_filter_test::list_buckets_filters_with_iam_bucket_resources",
|
||||
"list_object_versions_metadata_extension_test::tests::test_list_object_versions_metadata_extension_returns_metadata_tags_and_internal",
|
||||
"list_object_versions_regression_test::tests::test_list_object_versions_immediately_returns_latest_put_after_delete_marker",
|
||||
"list_object_versions_regression_test::tests::test_list_object_versions_prefix_with_marker_object_returns_children",
|
||||
@@ -79,13 +87,27 @@ e2e = [
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_raw_exceeds_maxkeys_but_visible_below",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_repeated_prefix_continuation",
|
||||
"multipart_auth_test::test_anonymous_post_object_accepts_fields_covered_by_policy_conditions",
|
||||
"multipart_auth_test::test_anonymous_post_object_accepts_form_fields_covered_by_policy_conditions",
|
||||
"multipart_auth_test::test_anonymous_post_object_accepts_success_action_redirect_exact_policy_match",
|
||||
"multipart_auth_test::test_anonymous_post_object_defaults_to_no_content",
|
||||
"multipart_auth_test::test_anonymous_post_object_honors_success_action_redirect",
|
||||
"multipart_auth_test::test_anonymous_post_object_honors_success_action_status",
|
||||
"multipart_auth_test::test_signed_put_object_extract_accepts_compat_header",
|
||||
"multipart_auth_test::test_signed_put_object_extract_expands_s2_and_lz4_by_magic_with_raw_etags",
|
||||
"multipart_auth_test::test_signed_put_object_extract_expands_tar_entries_with_prefix_headers",
|
||||
"multipart_auth_test::test_signed_put_object_extract_expands_tar_gz_archive",
|
||||
"multipart_auth_test::test_signed_put_object_extract_expands_tbz2_archive",
|
||||
"multipart_auth_test::test_signed_put_object_extract_normalizes_prefix_header_value",
|
||||
"multipart_auth_test::test_signed_put_object_extract_pax_retention_overrides_request_retention",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_directory_markers_by_default",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_entry_mtime",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_object_lock_legal_hold",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_object_lock_retention",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_request_metadata_on_extracted_objects",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_sse_c",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_sse_s3_and_redirect",
|
||||
"multipart_copy_readiness_test::harbor_style_multipart_staging_copy_object_boundaries",
|
||||
"multipart_copy_readiness_test::multipart_complete_invalid_etag_returns_400_and_preserves_retry",
|
||||
"multipart_storage_class_test::tests::list_parts_sdk_paginator_terminates_and_preserves_completion",
|
||||
"multipart_storage_class_test::tests::multipart_copy_preserves_standard_and_rrs",
|
||||
"multipart_storage_class_test::tests::multipart_upload_preserves_standard_and_rrs_across_retry_and_resume",
|
||||
@@ -113,9 +135,18 @@ e2e = [
|
||||
"object_lock::object_lock_test::test_unretained_object_lock_object_delete_and_bucket_cleanup",
|
||||
"object_lock::object_lock_test::test_versioning_auto_enabled_with_object_lock",
|
||||
"on_demand_migration::get_basic_test::get_large_object_streams_through_and_backfills_in_background",
|
||||
"on_demand_migration::get_basic_test::get_with_version_id_does_not_consult_the_source",
|
||||
"on_demand_migration::get_basic_test::head_miss_answers_from_the_source_without_persisting",
|
||||
"on_demand_migration::interaction_test::test_odm_pull_emits_object_created_events_unless_disabled",
|
||||
"on_demand_migration::interaction_test::test_odm_pulled_object_inherits_object_lock_retention",
|
||||
"on_demand_migration::interaction_test::test_odm_pulled_object_replicates_and_target_as_source_is_rejected",
|
||||
"reliant::lifecycle::test_lifecycle_expiry_backdated_mtime",
|
||||
"reliant::lifecycle::test_lifecycle_noncurrent_expiry_then_cleans_expired_delete_marker",
|
||||
"reliant::s3_select_compression::test_select_object_content_invalid_compressed_stream_fails",
|
||||
"replication_lww_receiver_test::receiver_lww_keeps_newer_tags_across_delivery_orders",
|
||||
"select_request_root_alias_test::select_request_root_alias_reaches_select_endpoint",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_applies_member_semantics_and_metadata_precedence",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_prefers_exact_minio_prefix_over_suffix_fallback",
|
||||
"special_chars_test::tests::test_copy_object_with_special_chars",
|
||||
"special_chars_test::tests::test_delete_object_with_special_chars",
|
||||
"special_chars_test::tests::test_head_object_with_special_chars",
|
||||
@@ -128,6 +159,7 @@ e2e = [
|
||||
"special_chars_test::tests::test_signed_get_missing_object_with_trailing_equals_returns_no_such_key",
|
||||
"special_chars_test::tests::test_special_chars_in_different_path_positions",
|
||||
"special_chars_test::tests::test_unicode_characters_in_path",
|
||||
"sts_query_compat_test::test_bucket_tags_opa_contract",
|
||||
"version_id_regression_test::tests::test_basic_s3_operations_no_regression",
|
||||
"version_id_regression_test::tests::test_copy_object_omits_version_id_with_suspended_versioning",
|
||||
"version_id_regression_test::tests::test_copy_object_returns_version_id_with_versioning",
|
||||
@@ -199,9 +231,12 @@ ceph = [
|
||||
"test_get_obj_head_tagging",
|
||||
"test_get_obj_tagging",
|
||||
"test_list_multipart_upload",
|
||||
"test_multipart_checksum_sha256",
|
||||
"test_multipart_copy_without_range",
|
||||
"test_multipart_upload_empty",
|
||||
"test_multipart_upload_overwrite_existing_object",
|
||||
"test_object_checksum_crc64nvme",
|
||||
"test_object_content_encoding_aws_chunked",
|
||||
"test_object_copy_diff_bucket",
|
||||
"test_object_copy_replacing_metadata",
|
||||
"test_object_copy_retaining_metadata",
|
||||
@@ -232,11 +267,14 @@ ceph = [
|
||||
"test_ranged_request_response_code",
|
||||
"test_ranged_request_return_trailing_bytes_response_code",
|
||||
"test_ranged_request_skip_leading_bytes_response_code",
|
||||
"test_rm_bucket_logging",
|
||||
"test_set_bucket_tagging",
|
||||
"test_set_cors",
|
||||
"test_set_multipart_tagging",
|
||||
"test_versioning_bucket_atomic_upload_return_version_id",
|
||||
"test_versioning_bucket_create_suspend",
|
||||
"test_versioning_bucket_multipart_upload_return_version_id",
|
||||
"test_versioning_obj_create_read_remove",
|
||||
]
|
||||
|
||||
# Same-byte replay uses cases that do not feed a server-generated object version or upload ID into a later request.
|
||||
|
||||
@@ -33,6 +33,7 @@ from urllib.request import ProxyHandler, build_opener
|
||||
|
||||
MINIMUM_ENTRIES = 1000
|
||||
MAXIMUM_ENTRIES = 2000
|
||||
CEPH_VIRTUAL_HOST = "s3.localhost"
|
||||
|
||||
|
||||
def select_tests(scope):
|
||||
@@ -77,10 +78,10 @@ def revision(path):
|
||||
return subprocess.check_output(["git", "-C", path, "rev-parse", "HEAD"], text=True).strip()
|
||||
|
||||
|
||||
def ceph_config(temp, port, secret):
|
||||
def ceph_config(temp, port, secret, host="127.0.0.1"):
|
||||
config = Path(".github/s3tests/s3tests.conf").read_text()
|
||||
for key, value in {
|
||||
"S3_HOST": "127.0.0.1", "S3_PORT": str(port), "S3_ACCESS_KEY": "rustfsadmin-ci", "S3_SECRET_KEY": secret,
|
||||
"S3_HOST": host, "S3_PORT": str(port), "S3_ACCESS_KEY": "rustfsadmin-ci", "S3_SECRET_KEY": secret,
|
||||
"S3_ALT_ACCESS_KEY": "rustfsalt", "S3_ALT_SECRET_KEY": secrets.token_urlsafe(36),
|
||||
}.items():
|
||||
config = config.replace("${" + key + "}", value)
|
||||
@@ -127,25 +128,42 @@ def ceph_server(binary, temp, env, secret):
|
||||
srv.wait()
|
||||
|
||||
|
||||
def run_ceph(checkout, temp, env, tests):
|
||||
def run_ceph(checkout, temp, env, tests, *, virtual_host=False):
|
||||
"""Run the implemented upstream tests on a fresh single-node fixture."""
|
||||
implemented = set(Path("scripts/s3-tests/implemented_tests.txt").read_text().splitlines())
|
||||
if not set(tests) <= implemented:
|
||||
raise ValueError("Selected Ceph tests are missing from the implemented manifest")
|
||||
host = CEPH_VIRTUAL_HOST if virtual_host else "127.0.0.1"
|
||||
if virtual_host:
|
||||
temp.mkdir(exist_ok=True)
|
||||
sdk_config = temp / "aws-config"
|
||||
sdk_config.write_text("[default]\ns3 =\n addressing_style = virtual\n")
|
||||
env = dict(env, AWS_CONFIG_FILE=str(sdk_config), AWS_PROFILE="default",
|
||||
RUSTFS_SERVER_DOMAINS=host, NO_PROXY="*", no_proxy="*")
|
||||
secret = secrets.token_urlsafe(36)
|
||||
with ceph_server(env["CARGO_BIN_EXE_rustfs"], temp, env, secret) as port:
|
||||
conf_file = ceph_config(temp, port, secret)
|
||||
conf_file = ceph_config(temp, port, secret, host)
|
||||
with (temp / "ceph-tests.log").open("w") as log:
|
||||
# Use upstream's own assertions. Each test owns its bucket in this disposable store.
|
||||
command = [sys.executable, "-c", """
|
||||
import socket
|
||||
import sys
|
||||
from s3tests import functional
|
||||
from s3tests.functional import test_s3
|
||||
host = sys.argv[1]
|
||||
if host.endswith(".localhost"):
|
||||
# Keep SDK addressing and signing intact even on runners without wildcard localhost DNS.
|
||||
resolve = socket.getaddrinfo
|
||||
def local_lookup(name, *args, **kwargs):
|
||||
if isinstance(name, str) and (name == host or name.endswith("." + host)):
|
||||
name = "127.0.0.1"
|
||||
return resolve(name, *args, **kwargs)
|
||||
socket.getaddrinfo = local_lookup
|
||||
functional.configure()
|
||||
for test in sys.argv[1:]:
|
||||
for test in sys.argv[2:]:
|
||||
print("Running " + test, flush=True)
|
||||
getattr(test_s3, test)()
|
||||
""", *tests]
|
||||
""", host, *tests]
|
||||
result = subprocess.run(command, cwd=checkout, env=dict(env, S3TEST_CONF=str(conf_file)),
|
||||
stdout=log, stderr=log)
|
||||
if result.returncode:
|
||||
@@ -154,6 +172,16 @@ for test in sys.argv[1:]:
|
||||
raise RuntimeError(f"Ceph testing failed in {started[-1] if started else 'setup'}")
|
||||
|
||||
|
||||
def check_virtual_capture(directory):
|
||||
for path in directory.glob("*.jsonl"):
|
||||
with path.open() as entries:
|
||||
for line in entries:
|
||||
if any(name.lower() == "host" and value.partition(":")[0].endswith("." + CEPH_VIRTUAL_HOST)
|
||||
for name, value in json.loads(line)["headers"]):
|
||||
return
|
||||
raise ValueError("Ceph did not record a bucket addressed by virtual host")
|
||||
|
||||
|
||||
def count_entries(files, sources):
|
||||
counts = Counter()
|
||||
for path in files:
|
||||
@@ -200,9 +228,18 @@ def collect(args, temp):
|
||||
failed.add(fields[-1])
|
||||
raise RuntimeError(f"nextest exited {result.returncode}, failed cases {sorted(failed)}")
|
||||
print(f"Recording {len(tests['ceph'])} implemented Ceph tests ({args.suite})", flush=True)
|
||||
run_ceph(args.ceph, temp, dict(env, RUSTFS_CORPUS_RECORD_SRC=ceph_source), tests["ceph"])
|
||||
ceph_env = dict(env, RUSTFS_CORPUS_RECORD_SRC=ceph_source)
|
||||
run_ceph(args.ceph, temp, ceph_env, tests["ceph"])
|
||||
styles = ["path"]
|
||||
if args.suite == "nightly":
|
||||
virtual_raw = raw / "virtual"
|
||||
virtual_raw.mkdir(mode=0o700)
|
||||
run_ceph(args.ceph, temp / "ceph-virtual", dict(ceph_env, RUSTFS_CORPUS_DIR=str(virtual_raw)),
|
||||
tests["ceph"], virtual_host=True)
|
||||
check_virtual_capture(virtual_raw)
|
||||
styles.append("virtual")
|
||||
report = verify_capture(temp, args, {e2e_source, ceph_source})
|
||||
report.update(selection=args.suite, e2e_profile="e2e-full", selected_tests=tests)
|
||||
report.update(selection=args.suite, e2e_profile="e2e-full", selected_tests=tests, ceph_addressing_styles=styles)
|
||||
# The enclosing e2e_binary.py run verifies this identity before and after capture.
|
||||
identity = json.loads(Path(env["CARGO_BIN_EXE_rustfs"] + ".e2e.json").read_text())
|
||||
report.update(gateway_revision=gateway_rev, server_sha256=identity["binary_sha256"])
|
||||
@@ -216,7 +253,7 @@ def scan(gateway, root):
|
||||
|
||||
def verify_capture(temp, args, sources):
|
||||
raw = temp / "raw" / "corpus"
|
||||
files = sorted(raw.glob("*.jsonl"))
|
||||
files = sorted(raw.rglob("*.jsonl"))
|
||||
dest = temp / "checked" / "corpus"
|
||||
dest.parent.mkdir()
|
||||
scan(args.gateway, raw.parent)
|
||||
|
||||
@@ -63,6 +63,15 @@ class CaptureGateTests(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
capture.check_listing(listing, ["a", "b"])
|
||||
|
||||
def test_virtual_run_requires_a_bucket_in_the_recorded_host(self):
|
||||
path = self.temp / "requests.jsonl"
|
||||
for host in ["127.0.0.1:9000", "s3.localhost:9000", "bucket.s3.localhost.example"]:
|
||||
path.write_text(json.dumps({"headers": [["Host", host]]}) + "\n")
|
||||
with self.subTest(host=host), self.assertRaises(ValueError):
|
||||
capture.check_virtual_capture(self.temp)
|
||||
path.write_text(json.dumps({"headers": [["host", "bucket.s3.localhost:9000"]]}) + "\n")
|
||||
capture.check_virtual_capture(self.temp)
|
||||
|
||||
def test_missing_or_unexpected_source(self):
|
||||
path = self.temp / "raw.jsonl"
|
||||
sources = {"s3-tests@fixture", "rustfs-e2e@fixture"}
|
||||
|
||||
Reference in New Issue
Block a user