Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3399255
D4556.id14574.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D4556.id14574.diff
View Options
diff --git a/services/commtest/tests/backup/pull_backup.rs b/services/commtest/tests/backup/pull_backup.rs
--- a/services/commtest/tests/backup/pull_backup.rs
+++ b/services/commtest/tests/backup/pull_backup.rs
@@ -3,8 +3,8 @@
#[path = "../lib/tools.rs"]
mod tools;
-use tonic::Request;
use std::io::{Error as IOError, ErrorKind};
+use tonic::Request;
use crate::backup_utils::{
proto::pull_backup_response::Data, proto::pull_backup_response::Data::*,
@@ -63,9 +63,12 @@
"invalid state, expected compaction, got {:?}",
state
);
- current_id = backup_id.ok_or(IOError::new(ErrorKind::Other, "backup id expected but not received"))?;
+ current_id = backup_id.ok_or(IOError::new(
+ ErrorKind::Other,
+ "backup id expected but not received",
+ ))?;
println!(
- "compaction (id {}), pushing chunk (size: {})",
+ "compaction (id {}), pulling chunk (size: {})",
current_id,
chunk.len()
);
@@ -75,8 +78,16 @@
if state == State::Compaction {
state = State::Log;
}
- assert_eq!(state, State::Log, "invalid state, expected compaction");
- let log_id = log_id.ok_or(IOError::new(ErrorKind::Other, "log id expected but not received"))?;
+ assert_eq!(
+ state,
+ State::Log,
+ "invalid state, expected log, got {:?}",
+ state
+ );
+ let log_id = log_id.ok_or(IOError::new(
+ ErrorKind::Other,
+ "log id expected but not received",
+ ))?;
if log_id != current_id {
result.log_items.push(Item::new(
log_id.clone(),
@@ -92,34 +103,34 @@
println!("log (id {}) chunk size {}", current_id, chunk.len());
}
- Some(AttachmentHolders(holders)) => {
- let holders_split: Vec<&str> =
- holders.split(ATTACHMENT_DELIMITER).collect();
- if state == State::Compaction {
+ None => {}
+ }
+ if let Some(holders) = response.attachment_holders {
+ let holders_split: Vec<&str> =
+ holders.split(ATTACHMENT_DELIMITER).collect();
+ if state == State::Compaction {
+ for holder in holders_split {
+ if holder.len() == 0 {
+ continue;
+ }
println!("attachments for the backup: {}", holders);
- for holder in holders_split {
- if holder.len() == 0 {
- continue;
- }
- result
- .backup_item
- .attachments_holders
- .push(holder.to_string());
+ result
+ .backup_item
+ .attachments_holders
+ .push(holder.to_string());
+ }
+ } else if state == State::Log {
+ for holder in holders_split {
+ if holder.len() == 0 {
+ continue;
}
- } else if state == State::Log {
println!("attachments for the log: {}", holders);
- for holder in holders_split {
- if holder.len() == 0 {
- continue;
- }
- let log_items_size = result.log_items.len() - 1;
- result.log_items[log_items_size]
- .attachments_holders
- .push(holder.to_string())
- }
+ let log_items_size = result.log_items.len() - 1;
+ result.log_items[log_items_size]
+ .attachments_holders
+ .push(holder.to_string())
}
}
- None => {}
}
}
Ok(result)
diff --git a/services/commtest/tests/backup_test.rs b/services/commtest/tests/backup_test.rs
--- a/services/commtest/tests/backup_test.rs
+++ b/services/commtest/tests/backup_test.rs
@@ -61,10 +61,7 @@
// a big item that should be placed in the S3 right away
Item::new(
String::new(),
- vec![
- *tools::GRPC_CHUNK_SIZE_LIMIT,
- *tools::GRPC_CHUNK_SIZE_LIMIT,
- ],
+ vec![*tools::GRPC_CHUNK_SIZE_LIMIT, *tools::GRPC_CHUNK_SIZE_LIMIT],
vec![
"holder0".to_string(),
"holder1".to_string(),
diff --git a/services/commtest/tests/lib/tools.rs b/services/commtest/tests/lib/tools.rs
--- a/services/commtest/tests/lib/tools.rs
+++ b/services/commtest/tests/lib/tools.rs
@@ -25,8 +25,10 @@
pub const GRPC_METADATA_SIZE_BYTES: usize = 5;
lazy_static! {
- pub static ref DYNAMO_DB_ITEM_SIZE_LIMIT: usize = ByteSize::kib(400).as_u64() as usize;
- pub static ref GRPC_CHUNK_SIZE_LIMIT: usize = (ByteSize::mib(4).as_u64() as usize) - GRPC_METADATA_SIZE_BYTES;
+ pub static ref DYNAMO_DB_ITEM_SIZE_LIMIT: usize =
+ ByteSize::kib(400).as_u64() as usize;
+ pub static ref GRPC_CHUNK_SIZE_LIMIT: usize =
+ (ByteSize::mib(4).as_u64() as usize) - GRPC_METADATA_SIZE_BYTES;
}
#[allow(dead_code)]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 3, 2:40 AM (22 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609840
Default Alt Text
D4556.id14574.diff (4 KB)
Attached To
Mode
D4556: [services] Backup - pull backup - change tests
Attached
Detach File
Event Timeline
Log In to Comment