Repository navigation
Expand file tree
/
Copy pathtest_rustfs_pool_expand.sh
More file actions
executable file
·558 lines (507 loc) · 20.4 KB
/
Copy pathtest_rustfs_pool_expand.sh
File metadata and controls
executable file
·558 lines (507 loc) · 20.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
#!/usr/bin/env bash
set -Eeuo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TEST_TMP="$(mktemp -d)"
export TMPDIR="${TEST_TMP}"
export RUSTFS_POOL_SCRIPT_SOURCE_ONLY=1
unset RUSTFS_API_ENDPOINT RUSTFS_RC_ENDPOINT RUSTFS_ADMIN_ENDPOINT
unset RUSTFS_CONTROL_ENDPOINT RUSTFS_WARP_ENDPOINT RUSTFS_PROXY_ENDPOINT RUSTFS_PROXY_STAGE_HOOK
# shellcheck source=rustfs_pool_expand.sh
source "${SCRIPT_DIR}/rustfs_pool_expand.sh"
fail() {
printf 'FAIL: %s\n' "$*" >&2
exit 1
}
assert_eq() {
local expected="$1" actual="$2" label="$3"
[ "${actual}" = "${expected}" ] \
|| fail "${label}: expected '${expected}', got '${actual}'"
}
reset_endpoint_state() {
LEGACY_ENDPOINT="http://legacy.test:9000"
ADMIN_ENDPOINT=""
WARP_ENDPOINT=""
PROXY_ENDPOINT=""
PROXY_STAGE_HOOK=""
NODES=(vm000 vm001 vm002)
NODE_ENDPOINTS=(
"http://node1.test:9000"
"http://node2.test:9000"
"http://node3.test:9000"
)
WARP_CONCURRENT=32
STORAGEINFO_PROBE_RETRIES=3
STORAGEINFO_PROBE_RETRY_DELAY=0
}
test_endpoint_resolution() {
reset_endpoint_state
resolve_endpoints
assert_eq "http://legacy.test:9000" "${ADMIN_ENDPOINT}" "legacy admin fallback"
assert_eq "http://legacy.test:9000" "${WARP_ENDPOINT}" "legacy warp fallback"
reset_endpoint_state
ADMIN_ENDPOINT="http://admin.test:9000/"
WARP_ENDPOINT="http://warp.test:9000"
PROXY_ENDPOINT="http://proxy.test:9000"
resolve_endpoints
assert_eq "http://admin.test:9000" "${ADMIN_ENDPOINT}" "admin normalization"
assert_eq "http://warp.test:9000" "${WARP_ENDPOINT}" "warp override"
assert_eq "http://proxy.test:9000" "${PROXY_ENDPOINT}" "proxy override"
if (normalize_http_endpoint "https://admin.test:9000" >/dev/null 2>&1); then
fail "HTTPS endpoint should be rejected until warp TLS is implemented"
fi
if (normalize_http_endpoint "http://admin.test:9000/path" >/dev/null 2>&1); then
fail "endpoint paths should be rejected"
fi
if (normalize_http_endpoint $'http://admin.test:9000\nX-Injected: yes' >/dev/null 2>&1); then
fail "endpoint control characters should be rejected"
fi
}
MOCK_STATUS_FILE="${TEST_TMP}/curl-statuses"
MOCK_CALL_FILE="${TEST_TMP}/curl-calls"
curl() {
local output_file="" header_file="" write_format="" method="GET" url="" host_header="" arg status body
while [ "$#" -gt 0 ]; do
arg="$1"
shift
case "${arg}" in
-o) output_file="$1"; shift ;;
-D) header_file="$1"; shift ;;
-w) write_format="$1"; shift ;;
-X) method="$1"; shift ;;
-H)
case "$1" in Host:*) host_header="$1" ;; esac
shift
;;
http://*) url="${arg}" ;;
esac
done
status="$(head -n 1 "${MOCK_STATUS_FILE}")"
sed '1d' "${MOCK_STATUS_FILE}" > "${MOCK_STATUS_FILE}.next"
mv "${MOCK_STATUS_FILE}.next" "${MOCK_STATUS_FILE}"
printf '%s %s %s\n' "${method}" "${host_header}" "${url}" >> "${MOCK_CALL_FILE}"
if [[ "${url}" == */rustfs/admin/v3/pools/list* ]]; then
body="${MOCK_POOL_BODY:-[]}"
elif [ "${status}" = "200" ]; then
body='{"info":{"disks":[]}}'
else
body="mock response ${status}"
fi
if [ -n "${output_file}" ]; then
printf '%s' "${body}" > "${output_file}"
fi
if [ -n "${header_file}" ]; then
printf '%s\r\n' "HTTP/1.1 ${status}" 'x-rustfs-error-cause: namespace_lock_timeout' \
'x-amz-request-id: request-test' 'retry-after: 1' 'Set-Cookie: secret-cookie' > "${header_file}"
fi
if [ -n "${write_format}" ]; then
if [[ "${write_format}" == *time_connect* ]]; then
printf '%s\t0.010\t0.020\t0.030' "${status}"
else
printf '%s' "${status}"
fi
fi
[ "${status}" != "000" ]
}
set_mock_statuses() {
printf '%s\n' "$@" > "${MOCK_STATUS_FILE}"
: > "${MOCK_CALL_FILE}"
}
test_independent_routing_and_signing() {
reset_endpoint_state
ADMIN_ENDPOINT="http://admin.test:9000"
WARP_ENDPOINT="http://warp.test:9000"
PROXY_ENDPOINT="http://proxy.test:9000"
resolve_endpoints
set_mock_statuses 200 200
admin_api GET /rustfs/admin/v3/storageinfo "" >/dev/null
proxy_api GET /rustfs/admin/v3/storageinfo "" >/dev/null
grep -Fq 'Host: admin.test:9000 http://admin.test:9000/rustfs/admin/v3/storageinfo' "${MOCK_CALL_FILE}" \
|| fail "admin request was not signed and sent with the direct authority"
grep -Fq 'Host: proxy.test:9000 http://proxy.test:9000/rustfs/admin/v3/storageinfo' "${MOCK_CALL_FILE}" \
|| fail "proxy request was not signed and sent with the proxy authority"
}
test_storageinfo_retry_is_sticky() {
reset_endpoint_state
ADMIN_ENDPOINT="http://admin.test:9000"
resolve_endpoints
rm -f "${ADMIN_ANOMALY_FILE}"
set_mock_statuses 502 502 200
storageinfo_with_retry admin >/dev/null 2>"${TEST_TMP}/retry.log" \
|| fail "502,502,200 should recover for continued diagnostics"
assert_eq "3" "$(wc -l < "${MOCK_CALL_FILE}" | tr -d ' ')" "retry count"
grep -Fq 'direct admin storageinfo attempt 3/3 succeeded at http://admin.test:9000 (HTTP 200; http=200 connect=0.010 ttfb=0.020 total=0.030 curl_exit=0)' \
"${TEST_TMP}/retry.log" || fail "successful storageinfo probes must record endpoint, status, and timings"
grep -Fq '{"info":{"disks":[]}}' "${TEST_TMP}/retry.log" \
|| fail "successful storageinfo probes must retain the response body"
[ -s "${ADMIN_ANOMALY_FILE}" ] || fail "recovered failures must remain sticky"
if (assert_no_endpoint_anomalies >/dev/null 2>&1); then
fail "a recovered storageinfo failure must not qualify as a clean pass"
fi
rm -f "${ADMIN_ANOMALY_FILE}"
set_mock_statuses 403 200
if storageinfo_with_retry admin >/dev/null 2>"${TEST_TMP}/forbidden.log"; then
fail "403 storageinfo response should fail"
fi
assert_eq "1" "$(wc -l < "${MOCK_CALL_FILE}" | tr -d ' ')" "non-retryable status count"
rm -f "${ADMIN_ANOMALY_FILE}"
set_mock_statuses 502 502 502
if storageinfo_with_retry admin >/dev/null 2>"${TEST_TMP}/persistent.log"; then
fail "persistent 502 responses should fail"
fi
assert_eq "3" "$(wc -l < "${MOCK_CALL_FILE}" | tr -d ' ')" "persistent retry count"
}
test_warp_must_reach_threshold() {
if (
storage_capacity_sample() { printf '{"sample_time":1,"disk_count":1,"total_bytes":107374182400,"used_bytes":10737418240,"usage_percent":10,"max_disk_percent":10,"min_free_bytes":96636764160}\n'; }
monitor_storage 50 999999
) >/dev/null 2>&1; then
fail "warp completion below the storage threshold must fail"
fi
}
test_monitor_propagates_storage_sample_failure() {
local status
if (
storage_capacity_sample() { return 1; }
monitor_storage 50 999999
) >/dev/null 2>&1; then
fail "storage sample failure must fail the monitor"
else
status=$?
fi
assert_eq 1 "${status}" "storage sample failure status"
}
test_monitor_rejects_an_unsafe_disk_even_when_average_is_low() (
local status=0
storage_capacity_sample() { printf '{"sample_time":1,"disk_count":4,"total_bytes":40000000000,"used_bytes":12000000000,"usage_percent":30,"max_disk_percent":99.9,"min_free_bytes":200704}\n'; }
monitor_storage 85 999999 >/dev/null 2>&1 || status=$?
assert_eq 4 "${status}" "capacity guard must not certify the storage target"
assert_eq 1 "${CAPACITY_EMERGENCY}" "near-full disk needs urgent writer stop"
)
test_active_capacity_sampling_does_not_retry_a_failed_api() (
reset_endpoint_state
resolve_endpoints
set_mock_statuses 503 200
if storage_capacity_sample >/dev/null 2>&1; then
fail "failed capacity probe must stop the writer rather than continue retries"
fi
assert_eq 1 "$(wc -l < "${MOCK_CALL_FILE}" | tr -d ' ')" "bounded active capacity sampling"
)
test_mpu_failure_keeps_cause_and_request_id_without_sensitive_headers() (
reset_endpoint_state
resolve_endpoints
set_mock_statuses 503
if (abort_stale_multipart_uploads fixture-bucket) >"${TEST_TMP}/mpu-error.log" 2>&1; then
fail "MPU 503 must fail cleanup"
fi
grep -q 'namespace_lock_timeout' "${TEST_TMP}/mpu-error.log" || fail "MPU error cause missing"
grep -q 'request-test' "${TEST_TMP}/mpu-error.log" || fail "MPU request ID missing"
if grep -q 'secret-cookie' "${TEST_TMP}/mpu-error.log"; then
fail "response cookies must not be published"
fi
)
test_stage_readiness_and_exact_pool_count() {
reset_endpoint_state
ADMIN_ENDPOINT="http://admin.test:9000"
resolve_endpoints
set_mock_statuses 200 000 000
verify_stage_readiness 1 >/dev/null \
|| fail "one-node stage should accept one ready and two inactive direct endpoints"
set_mock_statuses 200 200
if (verify_stage_readiness 1) >/dev/null 2>&1; then
fail "a future-stage node reporting ready must fail the topology barrier"
fi
PROXY_ENDPOINT=""
MOCK_POOL_BODY='[{"id":0,"status":"active"},{"id":1,"status":"active"}]'
set_mock_statuses 200
if (verify_pools 1) >/dev/null 2>&1; then
fail "pool verification must reject more pools than the stage expects"
fi
set_mock_statuses 200
verify_pools 2 >/dev/null || fail "pool verification should accept an exact active count"
unset MOCK_POOL_BODY
}
test_stage_pool_boundaries() (
local node_count="$1" stage="$2" expected_count="$1" first_pool=1
local fixture="${TEST_TMP}/topology-${node_count}-${stage}" node pool_index
local pools=()
mkdir -p "${fixture}"
NODES=(vm000 vm001 vm002)
[ "${node_count}" -ne 4 ] || NODES+=(vm003)
ASSUME_YES=1
DRY_RUN=1
FINALIZE_DECOMMISSION=1
DECOMMISSION_POOL_ID=0
ssh() { fail "topology tests must not contact a node"; }
service_action() { :; }
service_action_all() { :; }
ensure_volume_dirs() { :; }
start_and_wait_nodes() { :; }
wait_service_active() { :; }
wait_decommission() { :; }
verify_stage_readiness() { :; }
configure_proxy_stage() { :; }
write_rustfs_config() { printf '%s\n' "$2" > "${fixture}/$1"; }
verify_pools() { printf '%s\n' "$1" > "${fixture}/pool-count"; }
case "${stage}" in
expand) step7_expand_pool3 > "${fixture}/stage.log" ;;
decommission)
expected_count=$((node_count - 1))
first_pool=2
step9_decommission > "${fixture}/stage.log"
;;
*) fail "unknown topology test stage: ${stage}" ;;
esac
assert_eq "${expected_count}" "$(cat "${fixture}/pool-count")" "${stage} expected pool count"
for node in "${NODES[@]}"; do
read -r -a pools < "${fixture}/${node}"
assert_eq "${expected_count}" "${#pools[@]}" "${stage} ${node} independent pool expressions"
for ((pool_index = 0; pool_index < expected_count; pool_index++)); do
assert_eq "http://rustfs-node$((first_pool + pool_index)):9000/data/rustfs{1...4}/mnmd" \
"${pools[pool_index]}" "${stage} ${node} pool ${pool_index} endpoint order and drive range"
done
done
)
test_nginx_stage_rendering() {
local config
config="$("${SCRIPT_DIR}/rustfs_pool_nginx_stage.sh" render 2 \
http://rustfs-node1:9000 http://rustfs-node2:9000)"
grep -Fq 'server rustfs-node1:9000;' <<<"${config}" \
|| fail "stage proxy is missing node 1"
grep -Fq 'server rustfs-node2:9000;' <<<"${config}" \
|| fail "stage proxy is missing node 2"
if grep -Fq 'rustfs-node3:9000' <<<"${config}"; then
fail "stage proxy must not include a future-stage node"
fi
grep -Fq 'proxy_next_upstream off;' <<<"${config}" \
|| fail "stage proxy must not hide upstream failures"
grep -Fq 'proxy_set_header Host $http_host;' <<<"${config}" \
|| fail "stage proxy must preserve the SigV4 Host authority"
grep -Fq 'proxy_request_buffering off;' <<<"${config}" \
|| fail "stage proxy must stream large request bodies"
grep -Fq 'upstream_status="$upstream_status"' <<<"${config}" \
|| fail "stage proxy access log must record upstream status"
if "${SCRIPT_DIR}/rustfs_pool_nginx_stage.sh" render 1 https://rustfs-node1:9000 >/dev/null 2>&1; then
fail "stage proxy must reject unsupported upstream schemes"
fi
}
test_warp_error_classification() {
local warp_log="${TEST_TMP}/warp-classification.log"
printf '%s\n' 'SlowDown: foreground write concurrency limit reached' > "${warp_log}"
report_warp_errors "${warp_log}" >/dev/null \
|| fail "application-level SlowDown must not be classified as a proxy failure"
printf '%s\n' 'warp: <ERROR> upload error: SlowDown: foreground write concurrency limit reached' > "${warp_log}"
report_warp_errors "${warp_log}" >/dev/null \
|| fail "warp-prefixed SlowDown must not be classified as a transport failure"
printf '%s\n' '<title>502 Bad Gateway</title>' > "${warp_log}"
if report_warp_errors "${warp_log}" >/dev/null 2>&1; then
fail "Nginx 502 must fail warp transport classification"
fi
printf '%s\n' '<title>504 Gateway Time-out</title>' > "${warp_log}"
if report_warp_errors "${warp_log}" >/dev/null 2>&1; then
fail "Nginx 504 must fail warp transport classification"
fi
printf '%s\n' 'Put "http://proxy/bucket/object": connection closed' > "${warp_log}"
if report_warp_errors "${warp_log}" >/dev/null 2>&1; then
fail "connection closure must fail warp transport classification"
fi
printf '%s\n' 'net/http: timeout awaiting response headers' > "${warp_log}"
if report_warp_errors "${warp_log}" >/dev/null 2>&1; then
fail "response-header timeouts must fail warp transport classification"
fi
printf '%s\n' 'warp: <ERROR> upload error: The service is unavailable. Please retry.' > "${warp_log}"
if report_warp_errors "${warp_log}" >/dev/null 2>&1; then
fail "service-unavailable upload errors must fail warp classification"
fi
printf '%s\n' 'warp: <ERROR> upload error: We encountered an internal error, please try again.' > "${warp_log}"
if report_warp_errors "${warp_log}" >/dev/null 2>&1; then
fail "internal upload errors must fail warp classification"
fi
}
test_stop_skips_an_uninstalled_service() (
local fixture="${TEST_TMP}/stop-absent" bin="${TEST_TMP}/stop-absent-bin"
mkdir -p "${fixture}" "${bin}"
cat > "${bin}/systemctl" <<'EOF'
#!/usr/bin/env bash
[ "$1" = cat ] && exit 1
exit 1
EOF
chmod +x "${bin}/systemctl"
PATH="${bin}:${PATH}"
ssh() {
local remote="${*: -1}"
bash -c "${remote}"
}
service_action stop fixture-node
)
test_warp_rounds_reach_threshold() (
reset_endpoint_state
WITH_WARP=1
DRY_RUN=0
WARP_ROUNDS=2
WARP_LOG_FILE="${TEST_TMP}/warp-rounds.log"
monitor_calls=0
verify_stage_readiness() { :; }
configure_proxy_stage() { :; }
verify_pools() { :; }
confirm() { :; }
need_cmd() { :; }
warp() { :; }
abort_stale_multipart_uploads() { :; }
report_warp_errors() { :; }
check_capacity_before_write() { :; }
monitor_storage() {
monitor_calls=$((monitor_calls + 1))
if [ "${monitor_calls}" -eq 2 ]; then return 0; fi
return 3
}
step4_write_data >/dev/null 2>&1
assert_eq 2 "${monitor_calls}" "warp rounds before threshold"
)
test_capacity_guard_stops_writer_and_cleans_mpu_but_fails_step() (
reset_endpoint_state
WITH_WARP=1
DRY_RUN=0
WARP_LOG_FILE="${TEST_TMP}/guard-warp.log"
WARP_STOP_GRACE=1
verify_stage_readiness() { :; }
configure_proxy_stage() { :; }
verify_pools() { :; }
confirm() { :; }
need_cmd() { :; }
check_capacity_before_write() { :; }
warp() { exec sleep 30; }
abort_stale_multipart_uploads() { touch "${TEST_TMP}/guard-mpu-cleaned"; }
report_warp_errors() { :; }
monitor_storage() { CAPACITY_EMERGENCY=1; return 4; }
if (step4_write_data) >"${TEST_TMP}/guard-step.log" 2>&1; then
fail "capacity guard must fail the fill step"
fi
[ -f "${TEST_TMP}/guard-mpu-cleaned" ] || fail "capacity stop must retain MPU cleanup"
grep -q 'ENVIRONMENT-CAPACITY.*target was not certified' "${TEST_TMP}/guard-step.log" \
|| fail "capacity stop must be reported separately from target reached"
)
test_package_checksum_before_install() (
local script_name="$1" download_step="$2" install_step="$3"
local fixture="${TEST_TMP}/${script_name}" expected_hash scenario status expected
mkdir -p "${fixture}"
export RUSTFS_POOL_SCRIPT_SOURCE_ONLY=1 RUSTFS_HEAL_SCRIPT_SOURCE_ONLY=1 RUSTFS_PERF_SCRIPT_SOURCE_ONLY=1
# shellcheck source=/dev/null
source "${SCRIPT_DIR}/${script_name}"
NODES=(fixture-node)
ASSUME_YES=1
DRY_RUN=0
PACKAGE_URL=https://example.invalid/rustfs.deb
printf 'expected package\n' > "${fixture}/download-source"
expected_hash="$(openssl dgst -sha256 "${fixture}/download-source" | awk '{print $NF}')"
write_rustfs_config() { :; }
ensure_volume_dirs() { :; }
start_and_wait_nodes() { :; }
verify_pools() { :; }
ssh() {
local remote
remote="$(cat)"
remote="${remote//\/home\/rustfs\/packages/${fixture}/packages}"
remote="${remote//\/tmp\/rustfs.deb/${fixture}/download.deb}"
(
id() { printf '0\n'; }
systemctl() { :; }
curl() {
local output=""
while [ "$#" -gt 0 ]; do
if [ "$1" = "-o" ]; then output="$2"; shift; fi
shift
done
printf 'download\n' >> "${fixture}/curl-calls"
cp "${fixture}/download-source" "${output}"
}
dpkg() {
local pkg=""
if [ "$1" = "-i" ]; then
shift
while [ "$#" -gt 0 ]; do
case "$1" in
-*) shift ;;
*) pkg="$1"; break ;;
esac
done
printf 'install\n' >> "${fixture}/dpkg-calls"
cp "${pkg}" "${fixture}/installed"
fi
}
if ! command -v sha256sum >/dev/null 2>&1; then
sha256sum() { shasum -a 256 "$@"; }
export -f sha256sum
fi
export fixture
export -f id systemctl curl dpkg
bash -c "${remote}"
)
}
for scenario in valid wrong missing old download skip skip-old replaced removed no-checksum checksum-list invalid; do
rm -rf "${fixture}/packages"
mkdir -p "${fixture}/packages"
cp "${fixture}/download-source" "${fixture}/packages/rustfs.deb"
: > "${fixture}/curl-calls"
: > "${fixture}/dpkg-calls"
PACKAGE_SHA256="${expected_hash}"
SKIP_DOWNLOAD=0
expected=1
case "${scenario}" in
valid|download|skip|no-checksum) expected=0 ;;
esac
case "${scenario}" in
wrong) PACKAGE_SHA256="$(printf '%064d' 0)" ;;
missing) rm "${fixture}/packages/rustfs.deb" ;;
old|skip-old|no-checksum) printf 'old package\n' > "${fixture}/packages/rustfs.deb" ;;
invalid) PACKAGE_SHA256='$(touch '"${fixture}/injected"')' ;;
checksum-list)
printf 'old package\n' > "${fixture}/packages/rustfs.deb"
PACKAGE_SHA256="${expected_hash} ${fixture}/download-source"$'\n#'
;;
esac
[ "${scenario}" != no-checksum ] || PACKAGE_SHA256=""
case "${scenario}" in skip|skip-old) SKIP_DOWNLOAD=1 ;; esac
set +e
(
set -e
case "${scenario}" in download|skip|skip-old|replaced|removed) "${download_step}" ;; esac
[ "${scenario}" != replaced ] || printf 'replaced package\n' > "${fixture}/packages/rustfs.deb"
[ "${scenario}" != removed ] || rm "${fixture}/packages/rustfs.deb"
"${install_step}"
) > "${fixture}/${scenario}.log" 2>&1
status=$?
set -e
assert_eq "${expected}" "${status}" "${script_name} ${scenario} exit"
assert_eq "$((1 - expected))" "$(wc -l < "${fixture}/dpkg-calls" | tr -d ' ')" "${script_name} ${scenario} dpkg calls"
case "${scenario}" in
download|replaced|removed) assert_eq 1 "$(wc -l < "${fixture}/curl-calls" | tr -d ' ')" "${script_name} ${scenario} download calls" ;;
*) assert_eq 0 "$(wc -l < "${fixture}/curl-calls" | tr -d ' ')" "${script_name} ${scenario} download calls" ;;
esac
[ ! -e "${fixture}/injected" ] || fail "checksum was interpreted as shell code"
if [ "${expected}" -eq 0 ]; then
cmp "${fixture}/packages/rustfs.deb" "${fixture}/installed" || fail "installed bytes differ"
fi
done
)
test_package_checksum_before_install rustfs_heal_test.sh step1_download step2_install_and_start
test_package_checksum_before_install rustfs_pool_expand.sh step1_download step2_install
test_package_checksum_before_install rustfs_performance_test.sh step2_download step3_install
test_endpoint_resolution
test_independent_routing_and_signing
test_storageinfo_retry_is_sticky
test_warp_must_reach_threshold
test_monitor_propagates_storage_sample_failure
test_monitor_rejects_an_unsafe_disk_even_when_average_is_low
test_active_capacity_sampling_does_not_retry_a_failed_api
test_mpu_failure_keeps_cause_and_request_id_without_sensitive_headers
test_stop_skips_an_uninstalled_service
test_warp_rounds_reach_threshold
test_capacity_guard_stops_writer_and_cleans_mpu_but_fails_step
test_stage_readiness_and_exact_pool_count
test_stage_pool_boundaries 3 expand
test_stage_pool_boundaries 4 expand
test_stage_pool_boundaries 3 decommission
test_stage_pool_boundaries 4 decommission
test_nginx_stage_rendering
test_warp_error_classification
printf 'PASS: rustfs_pool_expand.sh endpoint and probe tests\n'