Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libparsec/crates/client/src/workspace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ impl WorkspaceOps {
///
/// However the workspace ops doesn't bother to interrogate the certificate
/// ops whenever it needs those information (this is partly because a newly
/// created workspace's informations are not yet available as certificate).
/// created workspace's information are not yet available as certificate).
///
/// Hence this workspace entry that bundles all the informations, but which
/// Hence this workspace entry that bundles all the information, but which
/// needs to be update whenever the corresponding certificates are updated.
pub(crate) fn update_workspace_external_info(
&self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use libparsec_tests_fixtures::prelude::*;
use libparsec_types::prelude::*;

use crate::workspace::OpenOptions;
use crate::{workspace::OpenOptions, ClientGetOutboundSyncBacklog};

use super::utils::client_factory;

Expand Down Expand Up @@ -50,3 +50,52 @@ async fn includes_started_workspaces_only(env: &TestbedEnv) {
.iter()
.all(|item| item.realm_id != not_started_workspace_id));
}

#[parsec_test(testbed = "minimal_client_ready")]
async fn not_including_confined_entries(env: &TestbedEnv) {
let alice = env.local_device("alice@dev1");
let wksp1_id: VlobID = *env.template.get_stuff("wksp1_id");
let wksp1_bar_txt_id: VlobID = *env.template.get_stuff("wksp1_bar_txt_id");
let client = client_factory(&env.discriminant_dir, alice.clone()).await;

let started_workspace = client.start_workspace(wksp1_id).await.unwrap();
started_workspace.outbound_sync(wksp1_id).await.unwrap();

let backlog = client.get_outbound_sync_backlog().await.unwrap();
println!(" {backlog:?}");

assert!(is_backlog_empty(backlog));
started_workspace
.rename_entry_by_id(
wksp1_id,
"bar.txt".try_into().unwrap(),
"bar.tmp".try_into().unwrap(),
crate::workspace::MoveEntryMode::NoReplace,
)
.await
.unwrap();

let fd = started_workspace
.open_file_by_id(wksp1_bar_txt_id, OpenOptions::read_write())
.await
.unwrap();
started_workspace
.fd_write(fd, 0, b"client-backlog-test")
.await
.unwrap();
started_workspace.fd_flush(fd).await.unwrap();
started_workspace.fd_close(fd).await.unwrap();

let backlog = client.get_outbound_sync_backlog().await.unwrap();
assert!(is_backlog_empty(backlog));
}

fn is_backlog_empty(backlog: ClientGetOutboundSyncBacklog) -> bool {
let mut res = true;
for e in backlog.per_workspace {
res = res && e.pending_bytes == 0 && e.pending_entries == 0
}

res && backlog.total_pending_entries_for_started_workspaces == 0
&& backlog.total_pending_bytes_for_started_workspaces == 0
}
Loading