mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-09 22:59:59 +00:00
fix: restore localized samples in tests (#749)
* fix: restore required localized examples * style: fix formatting issues
This commit is contained in:
@@ -387,7 +387,7 @@ mod tests {
|
||||
}
|
||||
assert_eq!(n, data.len());
|
||||
|
||||
// 读
|
||||
// Read
|
||||
let reader = bitrot_writer.into_inner();
|
||||
let reader = Cursor::new(reader.into_inner());
|
||||
let mut bitrot_reader = BitrotReader::new(reader, shard_size, HashAlgorithm::HighwayHash256);
|
||||
@@ -433,7 +433,7 @@ mod tests {
|
||||
let res = bitrot_reader.read(&mut buf).await;
|
||||
|
||||
if idx == count - 1 {
|
||||
// 最后一个块,应该返回错误
|
||||
// The last chunk should trigger an error
|
||||
assert!(res.is_err());
|
||||
assert_eq!(res.unwrap_err().kind(), std::io::ErrorKind::InvalidData);
|
||||
break;
|
||||
|
||||
@@ -58,7 +58,7 @@ impl Clone for ReedSolomonEncoder {
|
||||
Self {
|
||||
data_shards: self.data_shards,
|
||||
parity_shards: self.parity_shards,
|
||||
// 为新实例创建空的缓存,不共享缓存
|
||||
// Create an empty cache for the new instance instead of sharing one
|
||||
encoder_cache: std::sync::RwLock::new(None),
|
||||
decoder_cache: std::sync::RwLock::new(None),
|
||||
}
|
||||
@@ -947,7 +947,7 @@ mod tests {
|
||||
let block_size = 1024 * 1024; // 1MB block size
|
||||
let erasure = Erasure::new(data_shards, parity_shards, block_size);
|
||||
|
||||
// 创建2MB的测试数据,这样可以测试多个1MB块的处理
|
||||
// Build 2 MB of test data so multiple 1 MB chunks are exercised
|
||||
let mut data = Vec::with_capacity(2 * 1024 * 1024);
|
||||
for i in 0..(2 * 1024 * 1024) {
|
||||
data.push((i % 256) as u8);
|
||||
@@ -961,7 +961,7 @@ mod tests {
|
||||
data.len() / 1024
|
||||
);
|
||||
|
||||
// 编码数据
|
||||
// Encode the data
|
||||
let start = std::time::Instant::now();
|
||||
let shards = erasure.encode_data(&data).unwrap();
|
||||
let encode_duration = start.elapsed();
|
||||
|
||||
Reference in New Issue
Block a user