Files
simplexmq/tests/AgentTests.hs
T
Evgeny @ SimpleX Chat 73f734927f agent: read work items in one snapshot, report deleted files as NO_FILE (#2060)
* agent: skip work items deleted by a concurrent transaction

* agent: retry a work item batch whose items were all deleted, test skipping

* tests: skip work items deleted after their IDs were read

* agent: revert skipping of work items deleted after their ID query

* agent: lock work items and their connections in ID queries on PostgreSQL

* xftp: report a file deleted during transfer as NO_FILE, not INTERNAL

* tests: delete work items during worker reads and file transfers

* agent: retry worker reads aborted by PostgreSQL deadlock detection

* xftp: report NO_FILE when a file is deleted before its chunks are saved

* tests: lock tests on readers without item locks, deterministic NO_FILE tests

* agent: keep the SQLite text of work item ID queries unchanged

* tests: resume the upload in a new agent with the server down

* agent: retry transactions and batches aborted by PostgreSQL deadlocks

* tests: lock tests for six ID queries, NO_FILE when adding recipients

* agent: read work items in one snapshot, retry serialization failures

* xftp: report NO_FILE after a failed write when the file is deleted

* tests: work item reads with concurrent deletions on PostgreSQL

* tests: start the prepared file read by the prepare worker test

* agent: export transaction retry for chat work item reads

* agent: avoid shadowing STM retry in the transaction retry loop

* tests: wait for the lock held by the test's own transaction

* agent: retry read conflicts on the same database connection

* tests: retry bound of work item reads on PostgreSQL

* tests: qualify the agent INTERNAL error in retry bound tests

* tests: check retried reads use one connection and report the state

* tests: match the SQLSTATE field in retry bound tests

* tests: failed work item read is marked failed on PostgreSQL

* xftp: apply the deleted-file handler in infix form

* xftp: apply the deleted-file handler before multi-line writes

* agent: remove the unused read committed isolation level
2026-11-14 00:02:25 +00:00

53 lines
1.7 KiB
Haskell

{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PostfixOperators #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module AgentTests (agentCoreTests, agentTests) where
import AgentTests.ConnectionRequestTests
import AgentTests.DoubleRatchetTests (doubleRatchetTests)
import AgentTests.FunctionalAPITests (functionalAPITests)
import AgentTests.MigrationTests (migrationTests)
import AgentTests.ResolveNameTests (resolveNameTests)
import AgentTests.ServerChoice (serverChoiceTests)
import AgentTests.ShortLinkTests (shortLinkTests)
import Simplex.Messaging.Server.Env.STM (AStoreType (..))
import Simplex.Messaging.Transport (ASrvTransport)
import Test.Hspec hiding (fit, it)
#if defined(dbPostgres)
import AgentTests.FunctionalAPITests (workItemReadTests)
#else
import AgentTests.SQLiteTests (storeTests)
#endif
#if defined(dbServerPostgres)
import AgentTests.NotificationTests (notificationTests)
#endif
agentCoreTests :: Spec
agentCoreTests = do
describe "Migration tests" migrationTests
describe "Connection request" connectionRequestTests
describe "Double ratchet tests" doubleRatchetTests
describe "Short link tests" shortLinkTests
describe "resolve names" resolveNameTests
#if defined(dbPostgres)
describe "Work item reads" workItemReadTests
#endif
agentTests :: (ASrvTransport, AStoreType) -> Spec
agentTests ps = do
describe "Functional API" $ functionalAPITests ps
describe "Chosen servers" serverChoiceTests
#if defined(dbServerPostgres)
describe "Notification tests" $ notificationTests ps
#endif
#if !defined(dbPostgres)
describe "SQLite store" storeTests
#endif