mirror of
https://github.com/chatmail/core.git
synced 2026-07-09 20:42:52 +03:00
Compare commits
2 Commits
link2xt/ci
...
sk/group_e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a4dab9ade | ||
|
|
4479000b71 |
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@@ -226,11 +226,7 @@ jobs:
|
||||
# Minimum Supported Python Version = 3.7
|
||||
# This is the minimum version for which manylinux Python wheels are
|
||||
# built. Test it with minimum supported Rust version.
|
||||
#
|
||||
# Running on Ubuntu 22.04
|
||||
# because Ubuntu 24.04 runner does not support Python 3.7:
|
||||
# https://github.com/actions/setup-python/issues/962
|
||||
- os: ubuntu-22.04
|
||||
- os: ubuntu-latest
|
||||
python: 3.7
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
@@ -242,7 +238,7 @@ jobs:
|
||||
- name: Download libdeltachat.a
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.os == 'ubuntu-22.04' && 'ubuntu-latest' || matrix.os }}-libdeltachat.a
|
||||
name: ${{ matrix.os }}-libdeltachat.a
|
||||
path: target/debug
|
||||
|
||||
- name: Install python
|
||||
@@ -282,11 +278,7 @@ jobs:
|
||||
python: pypy3.10
|
||||
|
||||
# Minimum Supported Python Version = 3.7
|
||||
#
|
||||
# Running on Ubuntu 22.04
|
||||
# because Ubuntu 24.04 runner does not support Python 3.7:
|
||||
# https://github.com/actions/setup-python/issues/962
|
||||
- os: ubuntu-22.04
|
||||
- os: ubuntu-latest
|
||||
python: 3.7
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
60
src/chat.rs
60
src/chat.rs
@@ -4660,6 +4660,7 @@ mod tests {
|
||||
use crate::headerdef::HeaderDef;
|
||||
use crate::message::delete_msgs;
|
||||
use crate::receive_imf::receive_imf;
|
||||
use crate::securejoin::{get_securejoin_qr, join_securejoin};
|
||||
use crate::test_utils::{sync, TestContext, TestContextManager, TimeShiftFalsePositiveNote};
|
||||
use strum::IntoEnumIterator;
|
||||
use tokio::fs;
|
||||
@@ -7718,4 +7719,63 @@ mod tests {
|
||||
assert_eq!(draft1.timestamp_sort, draft2.timestamp_sort);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
/// Test for issue https://github.com/deltachat/deltachat-core-rust/issues/6408
|
||||
async fn test_race_condition() -> Result<()> {
|
||||
let mut tcm = TestContextManager::new();
|
||||
let alice = tcm.alice().await;
|
||||
let bob = tcm.bob().await;
|
||||
let group_editor = tcm.fiona().await;
|
||||
|
||||
// alice creates verified group with group editor bot
|
||||
tcm.execute_securejoin(&alice, &group_editor).await;
|
||||
let alice_chat_id = alice
|
||||
.create_group_with_members(
|
||||
ProtectionStatus::Protected,
|
||||
"Group with everyone",
|
||||
&[&group_editor],
|
||||
)
|
||||
.await;
|
||||
let msg = alice.send_text(alice_chat_id, "hi").await;
|
||||
let recv = group_editor.recv_msg(&msg).await;
|
||||
|
||||
// group editor bot sends a message
|
||||
let group_editor_chat_id = recv.chat_id;
|
||||
group_editor_chat_id.accept(&group_editor).await?;
|
||||
let webxdc = group_editor
|
||||
.send_text(group_editor_chat_id, "<Webxdc>")
|
||||
.await;
|
||||
alice.recv_msg(&webxdc).await;
|
||||
|
||||
tcm.section("bob scans alice' QR code");
|
||||
let join_qr = get_securejoin_qr(&alice, Some(alice_chat_id)).await?;
|
||||
join_securejoin(&bob, &join_qr).await.unwrap();
|
||||
loop {
|
||||
if let Some(sent) = bob.pop_sent_msg_opt(Duration::ZERO).await {
|
||||
alice.recv_msg_opt(&sent).await;
|
||||
} else if let Some(sent) = alice.pop_sent_msg_opt(Duration::ZERO).await {
|
||||
bob.recv_msg_opt(&sent).await;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let chatlist = Chatlist::try_load(&bob, 0, None, None).await?;
|
||||
println!(
|
||||
"{:?}",
|
||||
get_chat_contacts(&bob, chatlist.iter().last().unwrap().0).await?
|
||||
);
|
||||
|
||||
// group editor bot resends webxdc
|
||||
group_editor.recv_msg(&msg).await;
|
||||
resend_msgs(&group_editor, &[webxdc.sender_msg_id]).await?;
|
||||
let resent = group_editor.pop_sent_msg().await;
|
||||
|
||||
// Bob receives webxdc before joining the group
|
||||
bob.recv_msg(&resent).await;
|
||||
bob.recv_msg(&msg).await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ mod tests {
|
||||
let chats = Chatlist::try_load(&t, 0, Some("is:unread"), None)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(chats.len(), 1);
|
||||
assert!(chats.len() == 1);
|
||||
|
||||
let chats = Chatlist::try_load(&t, DC_GCL_ARCHIVED_ONLY, None, None)
|
||||
.await
|
||||
@@ -576,7 +576,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
|
||||
assert_eq!(chats.len(), 3);
|
||||
assert!(chats.len() == 3);
|
||||
assert!(!Chat::load_from_db(&t, chats.get_chat_id(0).unwrap())
|
||||
.await
|
||||
.unwrap()
|
||||
@@ -585,7 +585,7 @@ mod tests {
|
||||
let chats = Chatlist::try_load(&t, DC_GCL_FOR_FORWARDING, None, None)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(chats.len(), 2); // device chat cannot be written and is skipped on forwarding
|
||||
assert!(chats.len() == 2); // device chat cannot be written and is skipped on forwarding
|
||||
assert!(Chat::load_from_db(&t, chats.get_chat_id(0).unwrap())
|
||||
.await
|
||||
.unwrap()
|
||||
@@ -597,7 +597,7 @@ mod tests {
|
||||
let chats = Chatlist::try_load(&t, DC_GCL_FOR_FORWARDING, None, None)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(chats.len(), 1);
|
||||
assert!(chats.len() == 1);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
|
||||
@@ -1452,7 +1452,9 @@ impl Session {
|
||||
|
||||
let is_seen = fetch_response.flags().any(|flag| flag == Flag::Seen);
|
||||
|
||||
let Some(rfc724_mid) = uid_message_ids.get(&request_uid) else {
|
||||
let rfc724_mid = if let Some(rfc724_mid) = uid_message_ids.get(&request_uid) {
|
||||
rfc724_mid
|
||||
} else {
|
||||
error!(
|
||||
context,
|
||||
"No Message-ID corresponding to UID {} passed in uid_messsage_ids.",
|
||||
|
||||
@@ -686,7 +686,7 @@ async fn test_break_protection_then_verify_again() -> Result<()> {
|
||||
alice.create_chat(&bob).await;
|
||||
assert_verified(&alice, &bob, ProtectionStatus::Protected).await;
|
||||
let chats = Chatlist::try_load(&alice, DC_GCL_FOR_FORWARDING, None, None).await?;
|
||||
assert_eq!(chats.len(), 1);
|
||||
assert!(chats.len() == 1);
|
||||
|
||||
tcm.section("Bob reinstalls DC");
|
||||
drop(bob);
|
||||
@@ -709,7 +709,7 @@ async fn test_break_protection_then_verify_again() -> Result<()> {
|
||||
assert_eq!(chat.is_protected(), false);
|
||||
assert_eq!(chat.is_protection_broken(), true);
|
||||
let chats = Chatlist::try_load(&alice, DC_GCL_FOR_FORWARDING, None, None).await?;
|
||||
assert_eq!(chats.len(), 1);
|
||||
assert!(chats.len() == 1);
|
||||
|
||||
{
|
||||
let alice_bob_chat = alice.get_chat(&bob_new).await;
|
||||
|
||||
Reference in New Issue
Block a user