Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3502764
D4376.id14314.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D4376.id14314.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
@@ -4,9 +4,11 @@
mod tools;
use tonic::Request;
+use std::io::{Error as IOError, ErrorKind};
use crate::backup_utils::{
proto::pull_backup_response::Data, proto::pull_backup_response::Data::*,
+ proto::pull_backup_response::Id, proto::pull_backup_response::Id::*,
proto::PullBackupRequest, BackupServiceClient,
};
@@ -45,15 +47,26 @@
let mut current_id: String = String::new();
while let Some(response) = inbound.message().await? {
let response_data: Option<Data> = response.data;
- let id = response.id;
+ let id: Option<Id> = response.id;
+ let mut backup_id: Option<String> = None;
+ let mut log_id: Option<String> = None;
+ match id {
+ Some(BackupId(id)) => {
+ backup_id = Some(id)
+ },
+ Some(LogId(id)) => {
+ log_id = Some(id)
+ },
+ None => {},
+ };
match response_data {
Some(CompactionChunk(chunk)) => {
- assert!(
- state == State::Compaction,
+ assert_eq!(
+ state, State::Compaction,
"invalid state, expected compaction, got {:?}",
state
);
- current_id = id;
+ current_id = backup_id.ok_or(IOError::new(ErrorKind::Other, "backup id expected but not received"))?;
println!(
"compaction (id {}), pushing chunk (size: {})",
current_id,
@@ -65,12 +78,13 @@
if state == State::Compaction {
state = State::Log;
}
- assert!(state == State::Log, "invalid state, expected compaction");
- if id != current_id {
+ 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"))?;
+ if log_id != current_id {
result
.log_items
- .push(Item::new(id.clone(), Vec::new(), Vec::new()));
- current_id = id.clone();
+ .push(Item::new(log_id.clone(), Vec::new(), Vec::new()));
+ current_id = log_id;
}
let log_items_size = result.log_items.len() - 1;
result.log_items[log_items_size]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 5:06 AM (18 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2682614
Default Alt Text
D4376.id14314.diff (2 KB)
Attached To
Mode
D4376: [services] Tests - Separate backup id from log id for pull backup
Attached
Detach File
Event Timeline
Log In to Comment