fix tests

This commit is contained in:
Evgeny @ SimpleX Chat committed 2026-09-24 20:42:21 +00:00
1 parent 1fe16e3752
commit 86937931cb
3 files changed
+11 -17

No files matched your search

+2 -2
View File
@@ -540,7 +540,7 @@ getTermLine = getTermLine' Nothing
getTermLine' :: HasCallStack => Maybe String -> TestCC -> IO String
getTermLine' expected cc@TestCC {printOutput} =
5000000 `timeout` atomically (readTQueue $ termQ cc) >>= \case
20000000 `timeout` atomically (readTQueue $ termQ cc) >>= \case
Just s -> do
-- remove condition to always echo virtual terminal
-- when True $ do
@@ -553,7 +553,7 @@ getTermLine' expected cc@TestCC {printOutput} =
let expectedMsg = case expected of
Just e -> ", expected: " <> show e
Nothing -> ""
error $ name <> ": no output for 5 seconds" <> expectedMsg
error $ name <> ": no output for 20 seconds" <> expectedMsg
userName :: TestCC -> IO [Char]
userName TestCC {chatController = ChatController {currentUser}} =
+8 -5
View File
@@ -34,6 +34,7 @@ import Simplex.Chat.Store.Profiles (getUserContactProfiles)
import Simplex.Chat.Types
import Simplex.Chat.Types.Preferences
import Simplex.Chat.Types.Shared
import Simplex.FileTransfer.Description (FileSize (..))
import Simplex.Messaging.Agent.Client (agentClientStore)
import Simplex.Messaging.Agent.Store.AgentStore (maybeFirstRow, withTransaction)
import qualified Simplex.Messaging.Agent.Store.DB as DB
@@ -42,9 +43,8 @@ import Simplex.Messaging.Crypto.Ratchet (PQEncryption (..), PQSupport, pattern P
import Simplex.Messaging.Encoding.String
import Simplex.Messaging.Version
import System.Directory (doesFileExist)
import System.Environment (getExecutablePath, lookupEnv)
import System.Environment (lookupEnv)
import System.Info (os)
import System.Process (readProcess)
import Test.Hspec hiding (it)
import qualified Test.Hspec as Hspec
import UnliftIO (timeout)
@@ -889,9 +889,12 @@ linkAnotherSchema link
| otherwise = error "link starts with neither https://simplex.chat/ nor simplex:/"
xftpCLI :: [String] -> IO [String]
xftpCLI params = do
exe <- getExecutablePath
lines <$> readProcess exe ("xftp-cli" : params) ""
xftpCLI = \case
["rand", path, size] -> do
let FileSize n = fromString size :: FileSize Int
B.writeFile path =<< atomically . C.randomBytes n =<< C.newRandom
pure ["File created: " <> path]
params -> error $ "unsupported xftp CLI command: " <> unwords params
setRelativePaths :: HasCallStack => TestCC -> String -> String -> IO ()
setRelativePaths cc filesFolder tempFolder = do
+1 -10
View File
@@ -1,6 +1,5 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE TupleSections #-}
@@ -23,8 +22,6 @@ import ProtocolTests
import OperatorTests
import RandomServers
import RemoteTests
import Simplex.FileTransfer.Client.Main (xftpClientCLI)
import System.Environment (getArgs, withArgs)
import Test.Hspec hiding (it)
import UnliftIO.Temporary (withTempDirectory)
import ValidNames
@@ -43,13 +40,7 @@ import WebRTCTests
#endif
main :: IO ()
main =
getArgs >>= \case
"xftp-cli" : params -> withArgs params xftpClientCLI
_ -> runTests
runTests :: IO ()
runTests = do
main = do
setLogLevel LogError
#if !defined(dbPostgres)
chatQueryStats <- TM.emptyIO