From bacd330baf2e21125b48ba2ca96281ed36e9b92f Mon Sep 17 00:00:00 2001 From: Chris An Date: Thu, 3 Dec 2026 06:16:35 +0800 Subject: [PATCH] fix(ci): align architecture import, RPC/scanner tests, and stack sizes (#9877) --- .../tests/fair_prefix_quantum.rs | 2 ++ .../src/scanner_io/tests/service_cohort.rs | 11 +++++++-- rustfs/src/app/multipart_usecase/list.rs | 2 +- rustfs/src/app/storage_api.rs | 1 + rustfs/src/server/gateway_stack.rs | 21 ++++++++++++++-- .../gateway_stack/tests/control_plane.rs | 21 ++++++++++++++-- rustfs/src/server/http.rs | 24 ++++++++++++------- 7 files changed, 66 insertions(+), 16 deletions(-) diff --git a/crates/scanner/src/scanner_folder/tests/fair_prefix_quantum.rs b/crates/scanner/src/scanner_folder/tests/fair_prefix_quantum.rs index a03cc34499..7aa0d42cb6 100644 --- a/crates/scanner/src/scanner_folder/tests/fair_prefix_quantum.rs +++ b/crates/scanner/src/scanner_folder/tests/fair_prefix_quantum.rs @@ -673,12 +673,14 @@ async fn cold_linked_prefixes_resume_their_own_replica_coverage() { max_objects: Some(6), ..Default::default() }; + let tier_registry_generation = crate::runtime_tier_registry_for_cycle(1, 0).await.generation; // Six turns per disk leave one final B quantum. Each cold process must // recover that disk's linked tree as well as its complete child coverage. for round in 0..(2 * 40_usize.div_ceil(6) + 1) { let (root, peer) = if round < 12 && round % 2 == 0 { (&a, &b) } else { (&b, &a) }; let identity = crate::DataUsageScanIdentity { publication_epoch: u64::try_from(round).expect("bounded round") + 10, + tier_registry_generation, ..cache.info.scan_identity.expect("retained bucket identity") }; cache.prepare_bucket_checkpoint( diff --git a/crates/scanner/src/scanner_io/tests/service_cohort.rs b/crates/scanner/src/scanner_io/tests/service_cohort.rs index 15cdb37eab..edb3db418a 100644 --- a/crates/scanner/src/scanner_io/tests/service_cohort.rs +++ b/crates/scanner/src/scanner_io/tests/service_cohort.rs @@ -48,6 +48,10 @@ async fn create_cohort_bucket_objects(store: &ECStore, bucket: &str, objects: us .make_bucket(bucket, &MakeBucketOptions::default()) .await .expect("fixture bucket"); + write_cohort_bucket_objects(store, bucket, objects).await; +} + +async fn write_cohort_bucket_objects(store: &ECStore, bucket: &str, objects: usize) { for set in store.all_set_disks() { for index in 0..objects { let object = format!("object-{index:04}"); @@ -196,8 +200,11 @@ async fn service_cohort_production_dispatch_services_waiters_across_sources_case "ongoing dirty/new bootstrap must not displace the original cohort" ); - // Admission fairness is not completed coverage: the changed hot bucket - // produces a complete observation while its primary remains uncertified. + // Admission fairness is not completed coverage: once the hot bucket + // mutates under an active producer usage watch, cycle 5 produces a + // complete observation while its primary remains uncertified. + write_cohort_bucket_objects(&store, &hot, 1).await; + record_dirty_usage_bucket(&hot); let ctx = CancellationToken::new(); let (result, usage) = run_cohort_cycle(&store, cohort, 5, ScannerCycleBudget::new(&ctx, ScannerCycleBudgetConfig::default())).await; diff --git a/rustfs/src/app/multipart_usecase/list.rs b/rustfs/src/app/multipart_usecase/list.rs index df4f263e83..662a7be223 100644 --- a/rustfs/src/app/multipart_usecase/list.rs +++ b/rustfs/src/app/multipart_usecase/list.rs @@ -20,7 +20,7 @@ use crate::app::dto_values; use crate::app::storage_api::multipart_usecase::contract::multipart::ListMultipartsInfo; pub(crate) use crate::app::storage_api::multipart_usecase::contract::multipart::ListPartsInfo; use crate::app::storage_api::multipart_usecase::contract::multipart::ListPartsOwner; -use crate::app::storage_api::storage_class::effective_class; +use crate::app::storage_api::multipart_usecase::storage_class::effective_class; use rustfs_gateway_types::dto as gateway_dto; use rustfs_gateway_types::{BucketName, ObjectKey, RecordedUpload, UploadIdClaim, resolve_upload_async}; use rustfs_s3_types::S3Result; diff --git a/rustfs/src/app/storage_api.rs b/rustfs/src/app/storage_api.rs index 28473970fe..730e7c74cb 100644 --- a/rustfs/src/app/storage_api.rs +++ b/rustfs/src/app/storage_api.rs @@ -1802,6 +1802,7 @@ pub(crate) mod multipart_usecase { pub(crate) use super::{ access, bucket, compression, data_usage, error, helper, io, options, request_context, s3_api, set_disk, sse, + storage_class, }; pub(crate) use crate::storage::storage_api::{ DEFAULT_EC_BLOCK_SIZE, EC_BLOCK_SIZE_HINT_INTERNAL_SUFFIX, EC_BLOCK_SIZE_HINT_METADATA_KEY, diff --git a/rustfs/src/server/gateway_stack.rs b/rustfs/src/server/gateway_stack.rs index ba4692f142..4a8849d1b1 100644 --- a/rustfs/src/server/gateway_stack.rs +++ b/rustfs/src/server/gateway_stack.rs @@ -817,9 +817,26 @@ mod snowball_tests { use tokio_tar::Header; use uuid::Uuid; - #[tokio::test] + #[test] #[serial_test::serial] - async fn snowball_extract_preserves_sha256_failure_after_sniffing() { + fn snowball_extract_preserves_sha256_failure_after_sniffing() { + let handle = std::thread::Builder::new() + .name("snowball-sha256".to_string()) + .stack_size(8 * rustfs_config::DEFAULT_THREAD_STACK_SIZE) + .spawn(|| { + let runtime = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .expect("snowball test runtime"); + runtime.block_on(snowball_extract_preserves_sha256_failure_after_sniffing_case()); + }) + .expect("snowball test thread"); + if let Err(payload) = handle.join() { + std::panic::resume_unwind(payload); + } + } + + async fn snowball_extract_preserves_sha256_failure_after_sniffing_case() { let store = crate::app::gating_test_env::shared_gating_ecstore().await; if crate::runtime_sources::current_app_context().is_none() { crate::runtime_sources::install_test_app_context(Arc::clone(&store)).await; diff --git a/rustfs/src/server/gateway_stack/tests/control_plane.rs b/rustfs/src/server/gateway_stack/tests/control_plane.rs index f2d4067bd8..fb8a86cc7b 100644 --- a/rustfs/src/server/gateway_stack/tests/control_plane.rs +++ b/rustfs/src/server/gateway_stack/tests/control_plane.rs @@ -1087,9 +1087,26 @@ async fn assert_typed_admin_gets_and_object_lambda_fallback(stack: &GatewayStack } } -#[tokio::test] +#[test] #[serial_test::serial] -async fn typed_admin_routes_enforce_pre_body_iam_target_validation_and_presigned_object_lambda() { +fn typed_admin_routes_enforce_pre_body_iam_target_validation_and_presigned_object_lambda() { + let handle = std::thread::Builder::new() + .name("typed-admin-routes".to_string()) + .stack_size(8 * rustfs_config::DEFAULT_THREAD_STACK_SIZE) + .spawn(|| { + let runtime = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .expect("typed admin test runtime"); + runtime.block_on(typed_admin_routes_enforce_pre_body_iam_target_validation_and_presigned_object_lambda_case()); + }) + .expect("typed admin test thread"); + if let Err(payload) = handle.join() { + std::panic::resume_unwind(payload); + } +} + +async fn typed_admin_routes_enforce_pre_body_iam_target_validation_and_presigned_object_lambda_case() { use rustfs_gateway_dialect_rustfs_admin::native::{extensions, ops as native_ops}; let (_env, stack) = Box::pin(build_typed_admin_fixture()).await; diff --git a/rustfs/src/server/http.rs b/rustfs/src/server/http.rs index c3647e75f7..f5a072769b 100644 --- a/rustfs/src/server/http.rs +++ b/rustfs/src/server/http.rs @@ -9310,7 +9310,7 @@ mod tests { .send() .await .expect("incomplete upload response"); - assert_eq!(response.status(), StatusCode::INTERNAL_SERVER_ERROR); + assert_eq!(response.status(), StatusCode::BAD_REQUEST); let message = response.text().await.expect("upload error body"); assert!(message.contains("body size mismatch"), "unexpected upload failure: {message}"); assert!(root.path().join("bucket/incomplete").exists(), "file creation completed before failure"); @@ -9546,14 +9546,20 @@ mod tests { }) .service(RpcRequestPathService::new(Routes::new(node).prepare())); let server = tokio::spawn(async move { - let (socket, peer) = listener.accept().await.expect("accept ReadAll recovery connection"); - let service = ServiceBuilder::new() - .layer(AddExtensionLayer::new(Some(RemoteAddr(peer)))) - .service(service); - ConnBuilder::new(TokioExecutor::new()) - .serve_connection(TokioIo::new(socket), TowerToHyperService::new(service)) - .await - .expect("serve ReadAll recovery connection"); + let mut connections = tokio::task::JoinSet::new(); + loop { + let Ok((socket, peer)) = listener.accept().await else { + break; + }; + let service = ServiceBuilder::new() + .layer(AddExtensionLayer::new(Some(RemoteAddr(peer)))) + .service(service.clone()); + connections.spawn(async move { + let _ = ConnBuilder::new(TokioExecutor::new()) + .serve_connection(TokioIo::new(socket), TowerToHyperService::new(service)) + .await; + }); + } }); let mut endpoint = Endpoint::try_from(format!("http://{addr}/missing-read-all-disk").as_str()).expect("ReadAll remote endpoint");