mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-22 04:16:38 +00:00
Fix/ilm (#478)
This commit is contained in:
@@ -19,7 +19,7 @@ use rustfs_ecstore::{
|
|||||||
disk::endpoint::Endpoint,
|
disk::endpoint::Endpoint,
|
||||||
endpoints::{EndpointServerPools, Endpoints, PoolEndpoints},
|
endpoints::{EndpointServerPools, Endpoints, PoolEndpoints},
|
||||||
store::ECStore,
|
store::ECStore,
|
||||||
store_api::{ObjectIO, ObjectOptions, PutObjReader, StorageAPI},
|
store_api::{MakeBucketOptions, ObjectIO, ObjectOptions, PutObjReader, StorageAPI},
|
||||||
tier::tier::TierConfigMgr,
|
tier::tier::TierConfigMgr,
|
||||||
tier::tier_config::{TierConfig, TierMinIO, TierType},
|
tier::tier_config::{TierConfig, TierMinIO, TierType},
|
||||||
};
|
};
|
||||||
@@ -132,6 +132,22 @@ async fn create_test_bucket(ecstore: &Arc<ECStore>, bucket_name: &str) {
|
|||||||
info!("Created test bucket: {}", bucket_name);
|
info!("Created test bucket: {}", bucket_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Test helper: Create a test lock bucket
|
||||||
|
async fn create_test_lock_bucket(ecstore: &Arc<ECStore>, bucket_name: &str) {
|
||||||
|
(**ecstore)
|
||||||
|
.make_bucket(
|
||||||
|
bucket_name,
|
||||||
|
&MakeBucketOptions {
|
||||||
|
lock_enabled: true,
|
||||||
|
versioning_enabled: true,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.expect("Failed to create test bucket");
|
||||||
|
info!("Created test bucket: {}", bucket_name);
|
||||||
|
}
|
||||||
|
|
||||||
/// Test helper: Upload test object
|
/// Test helper: Upload test object
|
||||||
async fn upload_test_object(ecstore: &Arc<ECStore>, bucket: &str, object: &str, data: &[u8]) {
|
async fn upload_test_object(ecstore: &Arc<ECStore>, bucket: &str, object: &str, data: &[u8]) {
|
||||||
let mut reader = PutObjReader::from_vec(data.to_vec());
|
let mut reader = PutObjReader::from_vec(data.to_vec());
|
||||||
@@ -339,7 +355,6 @@ async fn test_lifecycle_expiry_basic() {
|
|||||||
tokio::time::sleep(Duration::from_secs(5)).await;
|
tokio::time::sleep(Duration::from_secs(5)).await;
|
||||||
|
|
||||||
// Check if object has been expired (delete_marker)
|
// Check if object has been expired (delete_marker)
|
||||||
//let check_result = object_is_delete_marker(&ecstore, bucket_name, object_name).await;
|
|
||||||
let check_result = object_exists(&ecstore, bucket_name, object_name).await;
|
let check_result = object_exists(&ecstore, bucket_name, object_name).await;
|
||||||
println!("Object is_delete_marker after lifecycle processing: {check_result}");
|
println!("Object is_delete_marker after lifecycle processing: {check_result}");
|
||||||
|
|
||||||
@@ -384,7 +399,7 @@ async fn test_lifecycle_expiry_deletemarker() {
|
|||||||
let object_name = "test/object.txt"; // Match the lifecycle rule prefix "test/"
|
let object_name = "test/object.txt"; // Match the lifecycle rule prefix "test/"
|
||||||
let test_data = b"Hello, this is test data for lifecycle expiry!";
|
let test_data = b"Hello, this is test data for lifecycle expiry!";
|
||||||
|
|
||||||
create_test_bucket(&ecstore, bucket_name).await;
|
create_test_lock_bucket(&ecstore, bucket_name).await;
|
||||||
upload_test_object(&ecstore, bucket_name, object_name, test_data).await;
|
upload_test_object(&ecstore, bucket_name, object_name, test_data).await;
|
||||||
|
|
||||||
// Verify object exists initially
|
// Verify object exists initially
|
||||||
@@ -433,6 +448,7 @@ async fn test_lifecycle_expiry_deletemarker() {
|
|||||||
tokio::time::sleep(Duration::from_secs(5)).await;
|
tokio::time::sleep(Duration::from_secs(5)).await;
|
||||||
|
|
||||||
// Check if object has been expired (deleted)
|
// Check if object has been expired (deleted)
|
||||||
|
//let check_result = object_is_delete_marker(&ecstore, bucket_name, object_name).await;
|
||||||
let check_result = object_exists(&ecstore, bucket_name, object_name).await;
|
let check_result = object_exists(&ecstore, bucket_name, object_name).await;
|
||||||
println!("Object exists after lifecycle processing: {check_result}");
|
println!("Object exists after lifecycle processing: {check_result}");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user