mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-22 10:07:31 +00:00
* bots, tests: run broadcast bot test in CI * tests: test moderation that arrives before the message * ci, tests: run all tests in CI * tests: update re-enabled tests, restore query plans, PostgreSQL schema from CI * tests: remove CI skip helpers no longer used * tests: expect XFTP AUTH error of cancelled standalone file * tests: update query plans from CI * tests: update query plans from CI * tests: expect group history and member contacts in async group test * tests: accept subscription summary after first events on restart * tests: make AUTH and client timeout direct tests deterministic * tests: keep bob's badge clock before renewal until the move back * tests: keep the quota of 2 messages only on the member's receive queue * tests: keep query plans files with repeated entries of one query * tests: update query plans from CI * tests: stop the host before a member requests to join with a badge * tests: remove repeated entries of one query from query plans files * tests: accept the refusal of an unknown remote host after its session code * ci: state when the query plans test fails * tests: skip multicast discovery on macOS CI runners * tests: accept a remote host started with one local address * tests: restore the client timeout test except its zero timeout * tests: fail when a remote host prints another line than its other addresses * ci: name the tests that overwrite generated files * tests: move the badge clock after the restoring device arms its wake * tests: keep both members on the quota server in the member inactivity test * tests: accept subscription summaries in any order in the async group test * tests: update query plans from CI * tests: quota of 2 only on bob's queues in member inactivity test * tests: connect to a deleted link after its queue is deleted * core: save relay connection before requesting relay link data * core: share relay connection creation between join and retry * tests: connect to a re-added relay when its connection is saved late * tests: delay only the relay connection record, not the command * tests: record API fixtures on SQLite only * core: update query plans * ci: run PostgreSQL tests with the steps of build-linux
146 lines
5.0 KiB
Haskell
146 lines
5.0 KiB
Haskell
{-# LANGUAGE CPP #-}
|
|
{-# LANGUAGE DuplicateRecordFields #-}
|
|
{-# LANGUAGE NamedFieldPuns #-}
|
|
{-# LANGUAGE TupleSections #-}
|
|
|
|
import Bots.BadgeService.BTCPayTests
|
|
import Bots.BadgeService.BotTests
|
|
import Bots.BadgeService.CatalogTests
|
|
import Bots.BadgeService.ConfigTests
|
|
import Bots.BadgeService.GroupIntegrationTests
|
|
import Bots.BadgeService.GroupTests
|
|
import Bots.BadgeService.StoreVerifierTests
|
|
import Bots.BadgeService.StripeTests
|
|
import Bots.BadgeService.WaitersTests
|
|
import Bots.BadgeService.WebTests
|
|
import Bots.BroadcastTests
|
|
import Bots.DirectoryTests
|
|
import ChatClient
|
|
import ChatTests
|
|
import ChatTests.DBUtils
|
|
import Control.Logger.Simple
|
|
import Data.Time.Clock.System
|
|
import BadgeTests
|
|
import ImageTests
|
|
import JSONTests
|
|
import MarkdownTests
|
|
import MemberRelationsTests
|
|
import MessageBatching
|
|
import ProtocolTests
|
|
import OperatorTests
|
|
import RandomServers
|
|
import RemoteTests
|
|
import Test.Hspec hiding (it)
|
|
#if !MIN_VERSION_hspec(2,10,10)
|
|
import Test.Hspec.Core.Spec (sequential)
|
|
#endif
|
|
import UnliftIO.Temporary (withTempDirectory)
|
|
import ValidNames
|
|
import ViewTests
|
|
#if defined(dbPostgres)
|
|
import Control.Exception (bracket_, finally)
|
|
import PostgresSchemaDump
|
|
import Simplex.Chat.Store.Postgres.Migrations (migrations)
|
|
import Simplex.Messaging.Agent.Store.Postgres.Util (createDBAndUserIfNotExists, dropDatabaseAndUser)
|
|
#else
|
|
import APIDocs
|
|
import ChatTests.Names (chatNamesTests)
|
|
import qualified Simplex.Messaging.TMap as TM
|
|
import MobileTests
|
|
import SchemaDump
|
|
import System.Info (os)
|
|
import WebRTCTests
|
|
#endif
|
|
|
|
main :: IO ()
|
|
main = do
|
|
setLogLevel LogError
|
|
#if !defined(dbPostgres)
|
|
chatQueryStats <- TM.emptyIO
|
|
agentQueryStats <- TM.emptyIO
|
|
#endif
|
|
portBases <- newPortBases
|
|
withTestDB . withTmpFiles . withGlobalLogging logCfg . hspec . parallel
|
|
$ do
|
|
#if defined(dbPostgres)
|
|
sequential $
|
|
describe "Postgres schema dump" $
|
|
postgresSchemaDumpTest
|
|
migrations
|
|
schemaDumpDBOpts
|
|
"src/Simplex/Chat/Store/Postgres/Migrations/chat_schema.sql"
|
|
#else
|
|
sequential $ describe "Schema dump" schemaDumpTest
|
|
#if MIN_VERSION_base(4,18,0)
|
|
sequential $ describe "Bot API docs" apiDocsTest
|
|
#endif
|
|
around tmpBracket $ describe "WebRTC encryption" webRTCTests
|
|
#endif
|
|
describe "Supporter badges" badgeTests
|
|
describe "SimpleX badge service" $ do
|
|
badgeConfigTests
|
|
badgeWebTests
|
|
badgeCatalogTests
|
|
badgeGroupTests
|
|
badgeWaitersTests
|
|
badgeBTCPayTests
|
|
badgeStripeTests
|
|
badgeStoreVerifierTests
|
|
describe "SimpleX chat markdown" markdownTests
|
|
describe "JSON Tests" jsonTests
|
|
describe "Member relations" memberRelationsTests
|
|
describe "SimpleX chat view" viewTests
|
|
describe "SimpleX chat protocol" protocolTests
|
|
describe "Valid names" validNameTests
|
|
describe "Message batching" batchingTests
|
|
describe "Operators" operatorTests
|
|
describe "Random servers" randomServersTests
|
|
describe "Image resize" imageTests
|
|
#if !defined(dbPostgres)
|
|
around (tmpTestBracket chatQueryStats agentQueryStats portBases) $ describe "names tests" chatNamesTests
|
|
around (tmpTestBracket chatQueryStats agentQueryStats portBases) $ describe "SimpleX Directory names" directoryNameTests
|
|
#endif
|
|
#if defined(dbPostgres)
|
|
around (testBracket portBases)
|
|
#else
|
|
around (testBracket chatQueryStats agentQueryStats portBases)
|
|
#endif
|
|
$ do
|
|
#if !defined(dbPostgres)
|
|
describe "Mobile API Tests" mobileTests
|
|
#endif
|
|
describe "SimpleX chat client" chatTests
|
|
describe "SimpleX Broadcast bot" broadcastBotTests
|
|
describe "SimpleX Directory service bot" directoryServiceTests
|
|
describe "SimpleX badge service e2e" $ do
|
|
badgeServiceTests
|
|
describe "managed group" badgeGroupIntegrationTests
|
|
describe "Remote session" remoteTests
|
|
#if !defined(dbPostgres)
|
|
sequential $ (if os == "linux" then describe else xdescribe) "Save query plans" saveQueryPlans
|
|
#endif
|
|
where
|
|
#if defined(dbPostgres)
|
|
withTestDB =
|
|
bracket_
|
|
(dropDatabaseAndUser testDBConnectInfo >> createDBAndUserIfNotExists testDBConnectInfo)
|
|
(dropDatabaseAndUser testDBConnectInfo)
|
|
testBracket portBases test =
|
|
withPortBase portBases $ \portBase -> tmpBracket $ \tmpPath -> do
|
|
let ps = TestParams {tmpPath, portBase, printOutput = False}
|
|
withSmpServer ps (test ps) `finally` dropTestSchemas ps
|
|
#else
|
|
withTestDB = id
|
|
testBracket chatQueryStats agentQueryStats portBases test =
|
|
tmpTestBracket chatQueryStats agentQueryStats portBases $ \ps -> withSmpServer ps $ test ps
|
|
tmpTestBracket chatQueryStats agentQueryStats portBases test =
|
|
withPortBase portBases $ \portBase -> tmpBracket $ \tmpPath -> test TestParams {tmpPath, portBase, chatQueryStats, agentQueryStats, printOutput = False}
|
|
#endif
|
|
tmpBracket test = do
|
|
t <- getSystemTime
|
|
let ts = show (systemSeconds t) <> show (systemNanoseconds t)
|
|
withTempDirectory "tests/tmp" ts test
|
|
|
|
logCfg :: LogConfig
|
|
logCfg = LogConfig {lc_file = Nothing, lc_stderr = True}
|