Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/friends' into friends
Browse files Browse the repository at this point in the history
  • Loading branch information
Shengtong Zhang committed Jun 29, 2022
2 parents b42e047 + f7bf199 commit 86d93a9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
name = "asphr",
commit = "f5f22e7913a3d27d1fdb40166725e5e018b15119", # autoupdate anysphere/asphr
commit = "a156ca92d10e65b93a1123fb80026788ce987e10", # autoupdate anysphere/asphr
init_submodules = True,
remote = "https://github.com/anysphere/asphr.git",
)
Expand Down
30 changes: 30 additions & 0 deletions daemon/db/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,36 @@ impl DB {
sent_and_received_count
);

// exactly 1 config always
let config_count = config::table.count().get_result::<i64>(conn_b).unwrap();
assert!(config_count == 1, "config_count = {}", config_count);

// if has_registered is true, then should have exactly 1 registration
let has_registered = config::table.select(config::has_registered).first::<bool>(conn_b).unwrap();
let registration_count = registration::table.count().get_result::<i64>(conn_b).unwrap();
if has_registered {
assert!(registration_count == 1, "registration_count = {}, has_registered = {}", registration_count, has_registered);
} else {
assert!(registration_count == 0, "registration_count = {}, has_registered = {}", registration_count, has_registered);
}

// transmission table iff !deleted
let transmission_non_deleted_count = friend::table.filter(friend::deleted.eq(false)).inner_join(transmission::table).count().get_result::<i64>(conn_b).unwrap();
let non_deleted_count = friend::table.filter(friend::deleted.eq(false)).count().get_result::<i64>(conn_b).unwrap();
let transmission_count = transmission::table.count().get_result::<i64>(conn_b).unwrap();
assert!(
transmission_non_deleted_count == non_deleted_count,
"transmission_non_deleted_count = {}, non_deleted_count = {}",
transmission_non_deleted_count,
non_deleted_count
);
assert!(
transmission_count == transmission_non_deleted_count,
"transmission_count = {}, transmission_non_deleted_count = {}",
transmission_count,
transmission_non_deleted_count
);

Ok(())
})
.unwrap();
Expand Down
4 changes: 0 additions & 4 deletions daemon/db/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,6 @@ fn test_send_msg() {
let msg = "hi im a single chunk";
db.queue_message_to_send("friend_1", msg, vec![msg.to_string()]).unwrap();

unsafe {
db.dump();
}

let chunk_to_send = db.chunk_to_send(vec![]).unwrap();

// the chunk to send will be the system message for the outgoing invitation
Expand Down

0 comments on commit 86d93a9

Please sign in to comment.