mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-16 06:37:54 +00:00
* core: add prepaid name codes and length bounds * store: run the names migration after badges * store: issue and revoke prepaid name codes * store: document issuing prepaid name codes * store: move the ABI helpers to Names.Abi * store: read the [names] and [chain] settings * store: add the names chain client and reads * store: refuse group name codes while names are off * store: search names and preview links * store: serve each site on its own port * scripts: deploy the badges and names sites * store: document search and the two sites * store: add the drop_taken_codes migration * store: read the names codes_only setting * store: add the names store and order signatures * store: take name orders by card, crypto or code * store: document name orders and codes-only * store: add the names transaction sender * store: commit and register queued orders * store: reveal and retry an owner's order * store: document the gas key * store: add the name balance migrations * store: read crypto units, rates and confirmations * store: keep a taken order's money as a balance * store: spend a balance on another name * store: record refunds with //refund * store: document balances and refunds * store: add the agreed terms migration * store: read the terms and community names * store: answer community and terms in search * store: sign and store the agreed terms * store: document the terms and community names * store: add the invoiced units migration * store: read the crypto an invoice asks * store: credit late and overpaid crypto by share * store: document crediting late crypto by share * store: add the record changes migration * store: find an owner's orders and move one * store: relay owners' link edits on chain * store: document link edits * store: move isLoopbackHost to Config * store: trust dev issuer keys on the local chain * scripts: build the names site from a submodule * scripts: add the dev setup and contract run * store: document the dev setup and names image * store: send a Stripe idempotency key for names * tests: wait until a relay lets go of its edit * store: refuse a link edit deadline under 10 min * store: count reverted link edits in the year limit * store: require https for a remote chain node * store: refuse zero chain confirmations * store: set up the dev stack from the names branch * store: rerun a failed unpaid cleanup next pass * store: never replace a succeeded Stripe intent * store: refuse an ini setting written as key: value * store: note the webapp submodule's pinned branch * store: document confirmLanded judging by ownerOf * store: update the names webapp submodule * store-service: register names under the name policy, every name accepting its terms on chain (#7889) * store: accept each name's terms on chain under the name policy * ci: run the reduced build on sh/names-deploy * store: address review: policy re-read, terms reads and startup log * store: never credit an unconfirmed extra * store: alert money sent to a paid name invoice * store: refuse to start on another chain's node * store: keep orders while the allowance is used up * store: replace a stalled transaction after 3 blocks * store: judge a name taken at confirmation depth * store: bind the template's listener to loopback * store: scan only the ids of active name orders * store: refuse unknown [names] and [chain] settings * store: fetch the webapp submodule in upgrade steps * store: delete definitions only tests use * store: lock only name invoices at settlement * store: retry an unexpired commitment as usual * store: share the helpers defined twice * store: test route limits on the running service * store: fix tests that could not fail * ci: test the store service on Postgres * store: count IPv6 clients by their /64 * store: sweep invoices read alone past a list cap * store: cap checkouts of all clients together * store: cap the long polls held at once * store: stop the old badge project at upgrade * store: keep search lookups free of previews * store: read the ini as UTF-8 in any locale * ci: run Postgres store tests in a UTF-8 locale * store: cap the transactions one order sends * store: cancel a card intent after three declines * store: refuse a name price under a cent * store: send each transaction with gas headroom * store: cap searches and read terms once per block * store: never log the group join link * store: mask the database password at startup * store: run one instance per database * store: limit name codes to admins, 100 a day * store: refuse HighSpeed settlement with names * store: no unverified receipts with a trusted key * store: cap the log lines of refused webhooks * store: check Apple certificates at the signed date * store: refuse a malformed Stripe publishable key * store: check the owner before a refund * store: fold the names migrations into one * store: read onion name links through the proxy * store: refund money after paid once confirmed * store: limit the allowance wait to a dry run * store: bind loopback when upgrading * ci: cache and widen the store Postgres job * store: fix stale and duplicate names tests * store: fix the submodule path in the upgrade * store: refuse unpaid name codes on the CLI * store: apply the review's names test list * store: finish the review's names test list * store: restore the base registration tests * store: pass link hosts that do not resolve here * store: refuse a move once its sends are used up * store: take the shared checkout at the provider * store: hold a search slot for chain reads only * store: state which refunds are safe on a reference * store: check a failed order's name before refusing its move (#8060) * store: test and document the shared checkout cap for name orders * store: check a failed order's name on chain before refusing its move * store: test name links whose host lookup fails * store: test that a search holds its slot through the chain reads only * store: restore the signed transaction check in the chain tests * store: remove the chain tests' copy of the signed transaction check * store: correct the search slot texts and the README's balance endpoints * docs: system and sequence diagrams of the names service (#8068) --------- Co-authored-by: sh-agents <350651734+sh-agents@users.noreply.github.com> Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com> Co-authored-by: brenzi-agent <brenzi-agent@brenzi.ch> Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
200 lines
6.8 KiB
Haskell
200 lines
6.8 KiB
Haskell
{-# LANGUAGE CPP #-}
|
|
{-# LANGUAGE DuplicateRecordFields #-}
|
|
{-# LANGUAGE NamedFieldPuns #-}
|
|
{-# LANGUAGE TupleSections #-}
|
|
|
|
import Bots.StoreService.BTCPayTests
|
|
import Bots.StoreService.BotTests
|
|
import Bots.StoreService.CatalogTests
|
|
import Bots.StoreService.ConfigTests
|
|
import Bots.StoreService.GroupIntegrationTests
|
|
import Bots.StoreService.GroupTests
|
|
import Bots.StoreService.NameRegistrationTests
|
|
import Bots.StoreService.NamesBalancesTests
|
|
import Bots.StoreService.NamesLateCreditTests
|
|
import Bots.StoreService.NamesChainTests
|
|
import Bots.StoreService.NamesCodesTests
|
|
import Bots.StoreService.NamesCommunityTests
|
|
import Bots.StoreService.NamesContractsTests
|
|
import Bots.StoreService.NamesLabelTests
|
|
import Bots.StoreService.NamesLinksTests
|
|
import Bots.StoreService.NamesOrdersTests
|
|
import Bots.StoreService.NamesOwnerTests
|
|
import Bots.StoreService.NamesPhasesTests
|
|
import Bots.StoreService.NamesProfilesTests
|
|
import Bots.StoreService.NamesRecordsTests
|
|
import Bots.StoreService.NamesRevealTests
|
|
import Bots.StoreService.NamesSearchTests
|
|
import Bots.StoreService.NamesSenderTests
|
|
import Bots.StoreService.NamesSignatureTests
|
|
import Bots.StoreService.NamesSpendTests
|
|
import Bots.StoreService.NamesStoreTests
|
|
import Bots.StoreService.NamesWiringTests
|
|
import Bots.StoreService.NamesWorkerTests
|
|
import Bots.StoreService.StoreVerifierTests
|
|
import Bots.StoreService.StripeTests
|
|
import Bots.StoreService.WaitersTests
|
|
import Bots.StoreService.WebTests
|
|
import Bots.BroadcastTests
|
|
import Bots.DirectoryTests
|
|
import ChatClient
|
|
import ChatTests
|
|
import ChatTests.DBUtils
|
|
import ChatTests.Utils (xdescribe'')
|
|
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
|
|
import WalletTests
|
|
#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 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 store service" $ do
|
|
badgeConfigTests
|
|
badgeWebTests
|
|
badgeCatalogTests
|
|
badgeGroupTests
|
|
badgeWaitersTests
|
|
badgeBTCPayTests
|
|
badgeStripeTests
|
|
badgeNameRegistrationTests
|
|
badgeStoreVerifierTests
|
|
namesConfigTests
|
|
namesBalancesTests
|
|
namesLateCreditTests
|
|
namesChainTests
|
|
namesCodesTests
|
|
namesCommunityTests
|
|
namesContractsTests
|
|
namesLabelTests
|
|
namesLinksTests
|
|
namesOrdersTests
|
|
namesOwnerTests
|
|
namesPhasesTests
|
|
namesProfilesTests
|
|
namesRecordsTests
|
|
namesRevealTests
|
|
namesSearchTests
|
|
namesSenderTests
|
|
namesSignatureTests
|
|
namesSpendTests
|
|
namesStoreTests
|
|
namesWiringTests
|
|
namesWorkerTests
|
|
describe "SimpleX chat markdown" markdownTests
|
|
describe "JSON Tests" jsonTests
|
|
describe "Member relations" memberRelationsTests
|
|
describe "SimpleX chat view" viewTests
|
|
describe "Wallet derivation" walletDerivationTests
|
|
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 "Wallet" walletTests
|
|
xdescribe'' "SimpleX Broadcast bot" broadcastBotTests
|
|
describe "SimpleX Directory service bot" directoryServiceTests
|
|
describe "SimpleX store service e2e" $ do
|
|
storeServiceTests
|
|
describe "managed group" badgeGroupIntegrationTests
|
|
describe "StoreService names: boot" namesBootTests
|
|
describe "StoreService names: worker" namesWorkerBootTests
|
|
namesCodesChatTests
|
|
namesRefundChatTests
|
|
namesSpendChatTests
|
|
namesProfilesChatTests
|
|
describe "Remote session" remoteTests
|
|
#if !defined(dbPostgres)
|
|
sequential $ 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}
|