fix tests

This commit is contained in:
Evgeny @ SimpleX Chat
2026-09-24 11:31:55 +00:00
parent d87e12fd1d
commit b454b735db
+16 -11
View File
@@ -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 =