Skip to content

Commit

Permalink
Turn on history sync with backup test (#1610)
Browse files Browse the repository at this point in the history
  • Loading branch information
codabrink authored Feb 7, 2025
1 parent e992898 commit cb8ee07
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 7 additions & 4 deletions xmtp_mls/src/groups/device_sync/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,11 @@ mod tests {
#[tokio::test]
#[cfg(not(target_arch = "wasm32"))]
async fn test_file_backup() {
use crate::utils::HISTORY_SYNC_URL;

let alix_wallet = generate_local_wallet();
let alix = ClientBuilder::new_test_client(&alix_wallet).await;
let alix =
ClientBuilder::new_test_client_with_history(&alix_wallet, HISTORY_SYNC_URL).await;
let alix_provider = Arc::new(alix.mls_provider().unwrap());

let bo_wallet = generate_local_wallet();
Expand All @@ -192,14 +195,14 @@ mod tests {
.conn_ref()
.raw_query_read(|conn| groups::table.load(conn))
.unwrap();
assert_eq!(groups.len(), 1);
assert_eq!(groups.len(), 2);
let old_group = groups.pop().unwrap();

let old_messages: Vec<StoredGroupMessage> = alix_provider
.conn_ref()
.raw_query_read(|conn| group_messages::table.load(conn))
.unwrap();
assert_eq!(old_messages.len(), 2);
assert_eq!(old_messages.len(), 6);

let opts = BackupOptions {
start_ns: None,
Expand All @@ -212,7 +215,7 @@ mod tests {

let key = vec![7; 32];
let mut exporter = BackupExporter::new(opts, &alix_provider, &key);
let path = Path::new("archive.zstd");
let path = Path::new("archive.xmtp");
let _ = std::fs::remove_file(path);
exporter.write_to_file(path).await.unwrap();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use super::*;
use crate::storage::{
group::ConversationType,
group_message::{ContentType, DeliveryStatus, GroupMessageKind, StoredGroupMessage},
schema::group_messages,
schema::{group_messages, groups},
};
use diesel::prelude::*;
use xmtp_id::associations::DeserializationError;
Expand All @@ -17,7 +18,10 @@ impl BackupRecordProvider for GroupMessageSave {
Self: Sized,
{
let mut query = group_messages::table
.left_join(groups::table)
.filter(groups::conversation_type.ne(ConversationType::Sync))
.filter(group_messages::kind.eq(GroupMessageKind::Application))
.select(group_messages::all_columns)
.order_by(group_messages::id)
.into_boxed();

Expand Down

0 comments on commit cb8ee07

Please sign in to comment.