From 3a0f908a4f9a83d47f2d0049b3bb903fd2c9a5d3 Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Mon, 5 Oct 2026 16:03:51 +0000 Subject: [PATCH] fix tests --- .../SQLite/Migrations/agent_query_plans.txt | 64 +++++++++---------- .../SQLite/Migrations/chat_query_plans.txt | 6 +- tests/Bots/DirectoryTests.hs | 11 ++-- tests/ChatTests/Direct.hs | 3 +- 4 files changed, 39 insertions(+), 45 deletions(-) diff --git a/src/Simplex/Chat/Store/SQLite/Migrations/agent_query_plans.txt b/src/Simplex/Chat/Store/SQLite/Migrations/agent_query_plans.txt index cb122cf4ee..fb677d8f0c 100644 --- a/src/Simplex/Chat/Store/SQLite/Migrations/agent_query_plans.txt +++ b/src/Simplex/Chat/Store/SQLite/Migrations/agent_query_plans.txt @@ -525,6 +525,23 @@ Query: Plan: SEARCH conn_confirmations USING INDEX idx_conn_confirmations_conn_id (conn_id=?) +Query: + SELECT conn_id, ( + SELECT processed_ratchet_key_hash_id + FROM processed_ratchet_key_hashes + WHERE conn_id = c.conn_id + ORDER BY processed_ratchet_key_hash_id DESC + LIMIT 1 OFFSET ? + ) AS max_excess_id + FROM processed_ratchet_key_hashes c + GROUP BY conn_id + HAVING COUNT(*) > ? + +Plan: +SCAN c USING COVERING INDEX idx_processed_ratchet_key_hashes_conn_id +CORRELATED SCALAR SUBQUERY 1 +SEARCH processed_ratchet_key_hashes USING COVERING INDEX idx_processed_ratchet_key_hashes_conn_id (conn_id=?) + Query: SELECT conn_id, ratchet_state, sender_key, e2e_snd_pub_key, sender_conn_info, smp_reply_queues, smp_client_version FROM conn_confirmations @@ -663,21 +680,6 @@ SEARCH snd_message_deliveries USING COVERING INDEX idx_snd_message_deliveries_co SEARCH snd_messages USING COVERING INDEX idx_snd_messages_conn_id_internal_id (conn_id=? AND internal_id=?) SEARCH rcv_messages USING COVERING INDEX idx_rcv_messages_conn_id_internal_id (conn_id=? AND internal_id=?) -Query: - DELETE FROM processed_ratchet_key_hashes - WHERE processed_ratchet_key_hash_id IN ( - SELECT processed_ratchet_key_hash_id - FROM processed_ratchet_key_hashes - WHERE created_at < ? - ORDER BY created_at ASC - LIMIT ? - ) - -Plan: -SEARCH processed_ratchet_key_hashes USING INTEGER PRIMARY KEY (rowid=?) -LIST SUBQUERY 1 -SEARCH processed_ratchet_key_hashes USING COVERING INDEX idx_processed_ratchet_key_hashes_created_at (created_at "#privacy (support) wrong" cath <# "#privacy (support) 'SimpleX Directory'> Too many failed attempts, you can't join group." - -- member removal produces multiple messages - _ <- getTermLine cath - _ <- getTermLine cath - _ <- getTermLine cath - pure () + let removed = "#privacy: 'SimpleX Directory' removed you from the group (signed)" + line <- getTermLine cath + when (line /= removed) $ do + line `shouldContain` "error: connection authorization failed" + cath <## removed + cath <## "use /d #privacy to delete the group" testCaptchaUnknownCommand :: HasCallStack => TestParams -> IO () testCaptchaUnknownCommand ps = diff --git a/tests/ChatTests/Direct.hs b/tests/ChatTests/Direct.hs index fbdc27160c..4afe7a31dd 100644 --- a/tests/ChatTests/Direct.hs +++ b/tests/ChatTests/Direct.hs @@ -1798,8 +1798,7 @@ testSubscribeAppNSE ps = withNewTestChat ps "alice" aliceProfile $ \alice -> do withTestChatOpts ps testOpts {coreOptions = testCoreOpts {maintenance = True}} "alice" $ \nseAlice -> do alice ##> "/_app suspend 1" - alice <## "ok" - alice <## "chat suspended" + alice <### ["ok", "chat suspended"] nseAlice ##> "/_start main=off" nseAlice <## "chat started" threadDelay 100000