Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/validation-catalog-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ on:
- scripts/run_validation_case.sh
- rustfs-replication-test.sh
- rustfs-storage-test.sh
- rustfs-tier-test.sh
- test_rustfs_tier.sh
- test_validation_scanner_usage.sh
- test_validation_scanner_usage.py
- rustfs-scanner-usage-test.sh
Expand Down Expand Up @@ -152,6 +154,8 @@ on:
- scripts/run_validation_case.sh
- rustfs-replication-test.sh
- rustfs-storage-test.sh
- rustfs-tier-test.sh
- test_rustfs_tier.sh
- test_validation_scanner_usage.sh
- test_validation_scanner_usage.py
- rustfs-scanner-usage-test.sh
Expand Down Expand Up @@ -195,5 +199,6 @@ jobs:
- run: bash -n scripts/run_validation_case.sh scripts/validation_heal/run_case.sh scripts/validation_oidc/run_case.sh
- run: bash -n rustfs-storage-test.sh rustfs_pool_expand.sh rustfs-replication-test.sh scripts/validation_pool/run_case.sh scripts/validation_replication/run_case.sh test_validation_scanner_usage.sh
- run: bash test_validation_scanner_usage.sh
- run: RUSTFS_TIER_TEST_MODE=versioned-cleanup bash test_rustfs_tier.sh
- run: python3 -B -m unittest -v test_validation_scanner_usage.py
- run: bash -n rustfs-scanner-usage-test.sh scripts/validation_scanner_usage/run_case.sh
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ Public observations cannot prove internal ACK ordering or cross-cycle races,
so missing candidate-native hooks remain BLOCKED or UNSUPPORTED.
The endpoint-only usage runner records operator-supplied candidate and binary
identities; it does not independently attest the remote installed binary.

Select the extra ILM cases through the validation workflow's `ilm-regressions` module or by case ID. `ilm.worm-expiration` follows current and historical versions through legal hold, expiry of unlocked controls, and expiration after release. `ilm.immediate-transition-and-restore` restarts the empty source with both scanners disabled to clear the rule-installation walk. The case verifies that a matching PUT reaches the dedicated remote tier, then waits for restore completion and reads back the original payload.

The canonical S3, KMS, IAM, and scanner smoke deployment cases above require a
candidate manifest with `source_sha`, `package_url`, and `package_sha256`.
Those deployment cases measure the installed binary SHA-256 on the test node
Expand Down Expand Up @@ -420,12 +423,6 @@ RUSTFS_TIER_TEST_MODE=versioned-cleanup ./test_rustfs_tier.sh
python3 -m unittest -v test_rustfs_tier_report.py
```

`TIER-115` (`VersionedTierDeleteCleanup`) runs in both topologies. It transitions
both versions of one key into a fresh unversioned remote bucket, removes the lifecycle rule, and confirms that an
ordinary delete hides the key while historical versions still block even a
forced tier removal. Both versions must remain readable. After deleting every
version and delete marker (checking per-object `DeleteObjects` errors), the case
requires natural remote cleanup and successful ordinary tier removal. The source
bucket and remote objects stay untouched by teardown until these assertions
finish. Cleanup and removal each have a 180-second deadline; only the expected
in-use response is retried after the remote namespace becomes empty.
`TIER-115` (`VersionedTierDeleteCleanup`) runs in both topologies. It transitions three versions of one key into a fresh unversioned remote bucket and records each new remote key. An ordinary delete creates a marker, with the three historical versions still readable and forced tier removal rejected. A targeted delete must remove the first source version and its exact remote key while preserving both other versions, their bytes, and the marker.

The case then deletes both remaining versions and the marker in one batch, checks per-object results, waits for natural remote cleanup, and removes the tier. Remote cleanup and tier removal each have a 180-second deadline.
34 changes: 24 additions & 10 deletions rustfs-storage-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ EOF
if [ "${VALIDATION_CASE}" = "scanner.usage-convergence" ] || [ "${VALIDATION_CASE}" = "scanner.status-readiness" ]; then
printf 'RUSTFS_SCANNER_ENABLED=true\nRUSTFS_SCANNER_CYCLE=5\nRUSTFS_SCANNER_START_DELAY_SECS=0\n'
elif [[ "${VALIDATION_CASE}" == ilm.* ]]; then
printf 'RUSTFS_SCANNER_ENABLED=true\nRUSTFS_SCANNER_CYCLE=2\nRUSTFS_SCANNER_START_DELAY_SECS=0\n'
if [ "${VALIDATION_CASE}" = ilm.immediate-transition-and-restore ]; then
printf 'RUSTFS_SCANNER_ENABLED=false\n'
else
printf 'RUSTFS_SCANNER_ENABLED=true\nRUSTFS_SCANNER_CYCLE=2\nRUSTFS_SCANNER_START_DELAY_SECS=0\n'
fi
printf 'RUSTFS_DATA_USAGE_UPDATE_DIR_CYCLES=1\nRUSTFS_ILM_DEBUG_DAY_SECS=10\nRUSTFS_ILM_PROCESS_TIME=1\n'
printf 'RUSTFS_API_STALE_UPLOADS_CLEANUP_INTERVAL=2s\n'
printf 'HTTP_PROXY=\nHTTPS_PROXY=\nALL_PROXY=\nhttp_proxy=\nhttps_proxy=\nall_proxy=\n'
Expand Down Expand Up @@ -283,6 +287,13 @@ volume_dirs() {

# ==================== Topology / environment ====================

ilm_case_uses_tier() {
case "${VALIDATION_CASE}" in
ilm.transition-and-restore|ilm.immediate-transition-and-restore) return 0 ;;
*) return 1 ;;
esac
}

resolve_topology() {
case "$1" in
"${TOPO_SINGLE_SINGLE}") ENDPOINT="${ENDPOINT_SINGLE_SINGLE}"; VOLUMES="${VOLUMES_SINGLE_SINGLE}"; return 0 ;;
Expand All @@ -297,7 +308,7 @@ topology_nodes() {
case "$1" in
"${TOPO_SINGLE_SINGLE}"|"${TOPO_SINGLE_MULTI}") printf '%s' "${NODES[0]}" ;;
"${TOPO_ILM_2X4}")
if [ "${VALIDATION_CASE}" = ilm.transition-and-restore ]; then
if ilm_case_uses_tier; then
printf '%s %s %s' "${NODES[0]}" "${NODES[1]}" "${NODES[2]}"
else
printf '%s %s' "${NODES[0]}" "${NODES[1]}"
Expand Down Expand Up @@ -341,7 +352,7 @@ EOF
for node in "${nodes[@]}"; do printf '%s\n' "${script}" | run_remote "${node}"; done

for node in "${nodes[@]}"; do
if [ "${VALIDATION_CASE}" = ilm.transition-and-restore ] && [ "${node}" = "${NODES[2]}" ]; then
if ilm_case_uses_tier && [ "${node}" = "${NODES[2]}" ]; then
VALIDATION_CASE="" write_rustfs_config "${node}" "${VOLUMES_SINGLE_SINGLE}"
ensure_volume_dirs "${node}" "${VOLUMES_SINGLE_SINGLE}"
else
Expand All @@ -361,7 +372,7 @@ EOF
sleep 5; waited=$((waited+5))
done
[ "${waited}" -lt "${SERVICE_TIMEOUT}" ] || die "S3 endpoint ${ENDPOINT} not ready"
if [ "${VALIDATION_CASE}" = ilm.transition-and-restore ]; then
if ilm_case_uses_tier; then
waited=0
while [ "${waited}" -lt "${SERVICE_TIMEOUT}" ]; do
if curl --noproxy '*' -fsS --max-time 5 "${ILM_TIER_ENDPOINT}/minio/health/live" >/dev/null 2>&1; then
Expand Down Expand Up @@ -598,11 +609,11 @@ validation_write_result() {
test_validation_ilm_case() {
local harness_dir="${TEST_TMP}/ilm-evidence" harness_rc=0
local -a ilm_args=()
if [ "${VALIDATION_CASE}" = ilm.restart-persistence ]; then
if [ "${VALIDATION_CASE}" = ilm.restart-persistence ] || [ "${VALIDATION_CASE}" = ilm.immediate-transition-and-restore ]; then
ilm_args+=(--restart-hook "$(python3 -c 'import json,sys; print(json.dumps(sys.argv[1:]))' \
bash "${SCRIPT_DIR}/scripts/validation_ilm/restart_cluster.sh" "${NODES[0]}" "${NODES[1]}")")
fi
if [ "${VALIDATION_CASE}" = ilm.transition-and-restore ]; then
if ilm_case_uses_tier; then
ilm_args+=(--tier-endpoint "${ILM_TIER_ENDPOINT}"
--tier-access-key "${ACCESS_KEY}" --tier-secret-key "${SECRET_KEY}")
fi
Expand Down Expand Up @@ -1423,7 +1434,10 @@ main() {
if [ -n "${VALIDATION_CASE}" ]; then
case "${VALIDATION_CASE}" in
scanner.usage-convergence|scanner.status-readiness) ;;
ilm.configuration-roundtrip|ilm.invalid-configuration|ilm.current-expiration|ilm.tag-filter-expiration|ilm.disabled-rule|ilm.rule-removal|ilm.versioned-current-expiration|ilm.noncurrent-expiration|ilm.newer-noncurrent-retention|ilm.delete-all-versions|ilm.delete-marker-expiration|ilm.multipart-expiration|ilm.restart-persistence|ilm.transition-and-restore) ;;
ilm.*)
need_cmd python3 "ILM case selection"
python3 -B -c 'import sys; sys.path.insert(0, sys.argv[1]); from scripts.validation_ilm.case_plan import ILM_SELECTABLE_CASE_IDS; sys.exit(sys.argv[2] not in ILM_SELECTABLE_CASE_IDS)' \
"${SCRIPT_DIR}" "${VALIDATION_CASE}" || die "unknown validation case: ${VALIDATION_CASE}" ;;
source-procedure.storage.*)
VALIDATION_SOURCE_CASE_ID="$(printf '%s' "${VALIDATION_CASE#source-procedure.storage.}" | tr '[:lower:]' '[:upper:]')"
SELECTED_CASES="${VALIDATION_SOURCE_CASE_ID}" ;;
Expand All @@ -1434,9 +1448,9 @@ main() {
[ "${KEEP_ENV}" -eq 0 ] || die "--validation-case requires environment teardown"
if [ "${VALIDATION_CASE}" = scanner.status-readiness ] || [[ "${VALIDATION_CASE}" == ilm.* ]]; then
SELECTED_TOPOLOGIES=("${TOPO_ILM_2X4}")
[ "${#NODES[@]}" -ge 2 ] || die "scanner.status-readiness needs two test nodes"
if [ "${VALIDATION_CASE}" = ilm.transition-and-restore ]; then
[ "${#NODES[@]}" -ge 3 ] || die "ilm.transition-and-restore needs three test nodes"
[ "${#NODES[@]}" -ge 2 ] || die "${VALIDATION_CASE} needs two test nodes"
if ilm_case_uses_tier; then
[ "${#NODES[@]}" -ge 3 ] || die "${VALIDATION_CASE} needs three test nodes"
fi
else
SELECTED_TOPOLOGIES=("${TOPO_SINGLE_MULTI}")
Expand Down
65 changes: 54 additions & 11 deletions rustfs-tier-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,21 @@ wait_remote_state() {
return 1
}

read_remote_tier_keys() {
local bucket="$1"
REMOTE_TIER_KEYS=""
aws_target_run_with_timeout "${REMOTE_PROBE_TIMEOUT}" s3api list-objects-v2 \
--bucket "${bucket}" --max-keys 4 --output json --no-paginate
assert_aws_ok || return 1
REMOTE_TIER_KEYS="$(jq -ce '
(if has("Contents") then .Contents else [] end) as $items |
if .IsTruncated == false and ($items | type) == "array" and .KeyCount == ($items | length)
and all($items[]; .Key | type == "string" and length > 0)
and ([$items[].Key] | unique | length) == ($items | length)
then [$items[].Key] | sort
else error("incomplete or malformed remote tier inventory") end' <<< "${AWS_OUT}")"
}

# An empty current listing is insufficient for a versioned bucket. Compare the
# complete user-visible inventory, including delete markers, without pagination.
assert_versioned_bucket_state() {
Expand Down Expand Up @@ -2849,7 +2864,9 @@ test_tier114() { # force=true must override a lifecycle-only tier reference; non

test_tier115() {
local topo_tag token source remote tier key=versioned.txt out job version marker body status i
local v1 v2 versions markers objects
local versions markers objects first_version first_remote_key first_remote_keys
local remote_keys='[]' expected_remote_keys retained
local -a version_ids=()
# Recovery scans may take over a minute after lifecycle removal.
local REMOTE_STATE_TIMEOUT=180
token="${RUN_TOKEN//-/}"
Expand All @@ -2872,12 +2889,12 @@ test_tier115() {
rc_run ilm rule add "local/${source}" --storage-class "${tier}" --transition-days 0
assert_rc_ok || return 1

for i in 1 2; do
for i in 1 2 3; do
make_test_file "${TEST_TMP}/tier115-v${i}" 1048576
aws_run s3api put-object --bucket "${source}" --key "${key}" --body "${TEST_TMP}/tier115-v${i}"
assert_aws_ok || return 1
version="$(printf '%s' "${AWS_OUT}" | jq -er '.VersionId | select(type == "string" and length > 0 and . != "null")')" || return 1
if [ "${i}" -eq 1 ]; then v1="${version}"; else v2="${version}"; fi
version_ids+=("${version}")
out="$(run_transition "${source}")" || return 1
job="$(printf '%s' "${out}" | jq -r '.job_id // empty')" || return 1
if [ -n "${job}" ]; then wait_transition_job "${job}" >/dev/null || return 1; fi
Expand All @@ -2886,31 +2903,57 @@ test_tier115() {
assert_aws_ok || return 1
printf '%s' "${AWS_OUT}" | jq -e --arg tier "${tier}" --arg version "${version}" \
'.StorageClass == $tier and .VersionId == $version' >/dev/null || return 1
# Each serial transition must add one remote identity and preserve the earlier ones.
read_remote_tier_keys "${remote}" || return 1
jq -e --argjson previous "${remote_keys}" --argjson count "${i}" \
'length == $count and ($previous - .) == []' <<< "${REMOTE_TIER_KEYS}" >/dev/null \
|| { echo "version ${version} did not add exactly one remote key: ${REMOTE_TIER_KEYS}"; return 1; }
remote_keys="${REMOTE_TIER_KEYS}"
if [ "${i}" -eq 1 ]; then first_remote_keys="${remote_keys}"; fi
printf 'Transitioned version %s, remote inventory %s\n' "${version}" "${remote_keys}"
done
[ "${v1}" != "${v2}" ] || { echo "overwrites did not create distinct versions"; return 1; }
wait_remote_state "${remote}" "" nonempty || return 1
first_version="${version_ids[0]}"
first_remote_key="$(jq -er '.[0]' <<< "${first_remote_keys}")" || return 1
expected_remote_keys="$(jq -c --argjson first "${first_remote_keys}" '. - $first' <<< "${remote_keys}")" || return 1
delete_lifecycle_and_assert_absent "${source}" || return 1

# A Console-style ordinary delete hides the key, but preserves both versions.
# A Console-style ordinary delete hides the key while preserving its history.
aws_run s3api delete-object --bucket "${source}" --key "${key}"
assert_aws_ok || return 1
marker="$(printf '%s' "${AWS_OUT}" | jq -er 'select(.DeleteMarker == true) | .VersionId | select(type == "string" and length > 0 and . != "null")')" || return 1
versions="$(jq -nc --arg key "${key}" --arg v1 "${v1}" --arg v2 "${v2}" '[{Key:$key,VersionId:$v1},{Key:$key,VersionId:$v2}]')"
versions="$(jq -nec --arg key "${key}" --args \
'$ARGS.positional | if (unique | length) == 3 then map({Key:$key,VersionId:.}) else error("duplicate version IDs") end' \
"${version_ids[@]}")" || return 1
markers="$(jq -nc --arg key "${key}" --arg marker "${marker}" '[{Key:$key,VersionId:$marker}]')"
assert_versioned_bucket_state "${source}" "${versions}" "${markers}" || return 1
body="$(admin_api DELETE "/rustfs/admin/v3/tier/${tier}" "force=true")"; status="$(admin_api_code)"
[ "${status}" = "409" ] && [ "$(xml_error_code "${body}")" = "XMinioAdminTierBackendInUse" ] \
|| { echo "force remove did not protect historical versions: HTTP ${status}"; return 1; }
assert_tier_present "${tier}" || return 1
for i in 1 2; do
if [ "${i}" -eq 1 ]; then version="${v1}"; else version="${v2}"; fi
for i in 1 2 3; do
version="${version_ids[i-1]}"
aws_run s3api get-object --bucket "${source}" --key "${key}" --version-id "${version}" "${TEST_TMP}/tier115-get${i}"
assert_aws_ok || return 1
cmp "${TEST_TMP}/tier115-v${i}" "${TEST_TMP}/tier115-get${i}" || return 1
done

aws_run s3api delete-object --bucket "${source}" --key "${key}" --version-id "${first_version}"
assert_aws_ok || return 1
retained="$(jq -c --arg id "${first_version}" 'map(select(.VersionId != $id))' <<< "${versions}")" || return 1
assert_versioned_bucket_state "${source}" "${retained}" "${markers}" || return 1
wait_remote_state "${remote}" "${first_remote_key}" empty || return 1
read_remote_tier_keys "${remote}" || return 1
[ "${REMOTE_TIER_KEYS}" = "${expected_remote_keys}" ] \
|| { echo "targeted deletion changed a retained remote key: expected ${expected_remote_keys}, observed ${REMOTE_TIER_KEYS}"; return 1; }
for i in 2 3; do
version="${version_ids[i-1]}"
aws_run s3api get-object --bucket "${source}" --key "${key}" --version-id "${version}" "${TEST_TMP}/tier115-get${i}"
assert_aws_ok || return 1
cmp "${TEST_TMP}/tier115-v${i}" "${TEST_TMP}/tier115-get${i}" || return 1
done
printf 'Deleted version %s only, retained remote inventory %s\n' "${first_version}" "${REMOTE_TIER_KEYS}"

printf 'Ordinary delete: current listing empty; both historical versions protected and readable.\n'
objects="$(jq -nc --argjson versions "${versions}" --argjson markers "${markers}" '$versions + $markers')"
objects="$(jq -nc --argjson versions "${retained}" --argjson markers "${markers}" '$versions + $markers')"
delete_object_versions_and_assert "${source}" "${objects}" || return 1
assert_versioned_bucket_state "${source}" '[]' '[]' || return 1
printf 'All user versions and delete markers removed; waiting for natural remote cleanup.\n'
Expand Down
4 changes: 2 additions & 2 deletions scripts/run_validation_case.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ case "${CASE_ID}" in
SUITE=rustfs-table-test.sh; EXTRA_ARGS=() ;;
source-procedure.upgrade.*)
SUITE=rustfs-upgrade-test.sh; EXTRA_ARGS=(--topology single-single --backends local) ;;
scanner.usage-convergence|scanner.status-readiness|ilm.configuration-roundtrip|ilm.invalid-configuration|ilm.current-expiration|ilm.tag-filter-expiration|ilm.disabled-rule|ilm.rule-removal|ilm.versioned-current-expiration|ilm.noncurrent-expiration|ilm.newer-noncurrent-retention|ilm.delete-all-versions|ilm.delete-marker-expiration|ilm.multipart-expiration|ilm.restart-persistence|ilm.transition-and-restore)
scanner.usage-convergence|scanner.status-readiness|ilm.*)
SUITE=rustfs-storage-test.sh; EXTRA_ARGS=() ;;
kms.sse-kms-round-trip)
SUITE=rustfs-kms-test.sh; EXTRA_ARGS=() ;;
Expand All @@ -52,7 +52,7 @@ case "${CASE_ID}" in
exit 2 ;;
esac

if [[ "${CASE_ID}" == pool.* || "${CASE_ID}" == bucket-replication.* || "${CASE_ID}" == site-replication.* || "${CASE_ID}" == scanner.usage-[0-9][0-9]-* || "${CASE_ID}" == s3.compatibility.* || "${CASE_ID}" == source-procedure.* ]]; then
if [[ "${CASE_ID}" == pool.* || "${CASE_ID}" == bucket-replication.* || "${CASE_ID}" == site-replication.* || "${CASE_ID}" == scanner.usage-[0-9][0-9]-* || "${CASE_ID}" == ilm.* || "${CASE_ID}" == s3.compatibility.* || "${CASE_ID}" == source-procedure.* ]]; then
python3 -B -c 'import json,sys; catalog=json.load(open(sys.argv[1])); valid={case["id"] for module in catalog["modules"]+catalog.get("local_modules",[]) for case in module["cases"]}; sys.exit(0 if sys.argv[2] in valid else 2)' \
"${SCRIPT_DIR}/validation-cases.json" "${CASE_ID}" || {
printf 'unknown canonical validation case: %s\n' "${CASE_ID}" >&2
Expand Down
17 changes: 11 additions & 6 deletions scripts/validation_ilm/case_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,28 @@


CATALOG = Path(__file__).resolve().parents[2] / "validation-cases.json"
IMMEDIATE_TRANSITION_CASE = "ilm.immediate-transition-and-restore"
WORM_EXPIRATION_CASE = "ilm.worm-expiration"


def ilm_case_ids() -> tuple[str, ...]:
def ilm_case_ids(module_id: str = "ilm-expiration") -> tuple[str, ...]:
catalog = json.loads(CATALOG.read_text(encoding="utf-8"))
modules = [module for module in catalog["modules"] if module["id"] == "ilm-expiration"]
modules = [module for module in catalog["modules"] + catalog.get("local_modules", []) if module["id"] == module_id]
if len(modules) != 1:
raise ValueError("canonical ILM module is missing or duplicated")
raise ValueError(f"ILM module is missing or duplicated: {module_id}")
return tuple(case["id"] for case in modules[0]["cases"])


ILM_CASE_IDS = ilm_case_ids()
ILM_SELECTABLE_CASE_IDS = ILM_CASE_IDS + ilm_case_ids("ilm-regressions")


def ilm_harness_scored_cases(requested_cases: Iterable[str] | None) -> tuple[str, ...]:
if requested_cases is None:
return ILM_CASE_IDS
selected = tuple(requested_cases)
if len(selected) != len(set(selected)) or set(selected) - set(ILM_CASE_IDS):
raise ValueError("duplicate or unknown canonical ILM case")
return tuple(case_id for case_id in ILM_CASE_IDS if case_id in selected)
if len(selected) != len(set(selected)) or set(selected) - set(ILM_SELECTABLE_CASE_IDS):
raise ValueError("duplicate or unknown ILM case")
if IMMEDIATE_TRANSITION_CASE in selected and len(selected) > 1:
raise ValueError("immediate transition requires an isolated scanner-disabled run")
return tuple(case_id for case_id in ILM_SELECTABLE_CASE_IDS if case_id in selected)
Loading