From b454b735db7fbb83883fb07b8edc2db4e8c16851 Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Thu, 24 Sep 2026 11:31:55 +0000 Subject: [PATCH] fix tests --- tests/ChatTests/Profiles.hs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tests/ChatTests/Profiles.hs b/tests/ChatTests/Profiles.hs index 0e5d219833..c58725f29c 100644 --- a/tests/ChatTests/Profiles.hs +++ b/tests/ChatTests/Profiles.hs @@ -18,6 +18,7 @@ import Control.Monad import Control.Monad.Except import qualified Data.Attoparsec.ByteString.Char8 as A import qualified Data.ByteString.Char8 as B +import Data.List (isSuffixOf) import qualified Data.Text as T import Data.Time.Clock (UTCTime, addUTCTime, getCurrentTime, nominalDay) import Data.Time.Clock.POSIX (posixSecondsToUTCTime) @@ -867,7 +868,8 @@ testRetryConnectingViaContactLink ps = testChatCfgOpts2 cfg' opts' aliceProfile { agentConfig = testAgentCfg { quotaExceededTimeout = 1, - messageRetryInterval = RetryInterval2 {riFast = fastRetryInterval, riSlow = fastRetryInterval} + messageRetryInterval = RetryInterval2 {riFast = fastRetryInterval, riSlow = fastRetryInterval}, + persistErrorInterval = 0 } } opts' = @@ -3487,7 +3489,7 @@ testShortLinkInvitationImage = testChat2 aliceProfile bobProfile test bob <##> alice testShortLinkInvitationConnectRetry :: HasCallStack => TestParams -> IO () -testShortLinkInvitationConnectRetry ps = testChatOpts2 opts' aliceProfile bobProfile test ps +testShortLinkInvitationConnectRetry ps = testChatCfgOpts2 cfg' opts' aliceProfile bobProfile test ps where test alice bob = do shortLink <- withSmpServer' serverCfg' $ do @@ -3525,6 +3527,7 @@ testShortLinkInvitationConnectRetry ps = testChatOpts2 opts' aliceProfile bobPro { transports = [("7003", transport @TLS, False)], serverStoreCfg = persistentServerStoreCfg tmp } + cfg' = testCfg {agentConfig = testAgentCfg {persistErrorInterval = 0}} opts' = testOpts { coreOptions = @@ -3653,8 +3656,8 @@ testShortLinkDeletedAddress = testChat2 aliceProfile bobProfile test testShortLinkAddressConnectRetry :: HasCallStack => TestParams -> IO () testShortLinkAddressConnectRetry ps = - withNewTestChatOpts ps opts' "alice" aliceProfile $ \alice -> - withNewTestChatOpts ps opts' "bob" bobProfile $ \bob -> do + withNewTestChatCfgOpts ps cfg' opts' "alice" aliceProfile $ \alice -> + withNewTestChatCfgOpts ps cfg' opts' "bob" bobProfile $ \bob -> do shortLink <- withSmpServer' serverCfg' $ do alice ##> "/ad" (shortLink, fullLink) <- getContactLinks alice True @@ -3698,6 +3701,7 @@ testShortLinkAddressConnectRetry ps = { transports = [("7003", transport @TLS, False)], serverStoreCfg = persistentServerStoreCfg tmp } + cfg' = testCfg {agentConfig = testAgentCfg {persistErrorInterval = 0}} opts' = testOpts { coreOptions = @@ -3708,8 +3712,8 @@ testShortLinkAddressConnectRetry ps = testShortLinkAddressConnectRetryIncognito :: HasCallStack => TestParams -> IO () testShortLinkAddressConnectRetryIncognito ps = - withNewTestChatOpts ps opts' "alice" aliceProfile $ \alice -> - withNewTestChatOpts ps opts' "bob" bobProfile $ \bob -> do + withNewTestChatCfgOpts ps cfg' opts' "alice" aliceProfile $ \alice -> + withNewTestChatCfgOpts ps cfg' opts' "bob" bobProfile $ \bob -> do shortLink <- withSmpServer' serverCfg' $ do alice ##> "/ad" (shortLink, fullLink) <- getContactLinks alice True @@ -3728,11 +3732,11 @@ testShortLinkAddressConnectRetryIncognito ps = bob ##> ("/_connect plan 1 " <> shortLink) bob <## "contact address: known prepared contact alice" bob ##> "/_connect contact @2 incognito=on text hello" - bobIncognito <- getTermLine bob - bob - <### [ "alice: connection started incognito", - WithTime "i @alice hello" - ] + line <- getTermLine bob + bobIncognito <- + if "i @alice hello" `isSuffixOf` line + then getTermLine bob <* bob <## "alice: connection started incognito" + else line <$ bob <### ["alice: connection started incognito", WithTime "i @alice hello"] alice <### [ ConsoleString (bobIncognito <> " wants to connect to you!"), WithTime (bobIncognito <> "> hello") @@ -3761,6 +3765,7 @@ testShortLinkAddressConnectRetryIncognito ps = { transports = [("7003", transport @TLS, False)], serverStoreCfg = persistentServerStoreCfg tmp } + cfg' = testCfg {agentConfig = testAgentCfg {persistErrorInterval = 0}} opts' = testOpts { coreOptions =