tests: inline expected errors in forwarded RSLV test

This commit is contained in:
shum committed 2026-10-16 15:26:49 +00:00
1 parent 593dcfcd4d
commit f6f856eddd
1 file changed
+6 -4
+6 -4
View File
@@ -177,19 +177,21 @@ testRslvForwardedSlotWaitTimeout =
withSmpServerConfigOn (transport @TLS) memProxyCfg testPort $ \_ ->
withSmpServerConfigOn (transport @TLS) (relayCfg port) testPort2 $ \_ -> do
rs <- replicateConcurrently 2 forwardedResolveAlice
rs `shouldMatchList` map rslvErr ["timeout", "too many requests"]
rs `shouldMatchList` [Left (PCEProtocolError (SMP.NAME (SMP.RESOLVER "timeout"))), Left (PCEProtocolError (SMP.NAME (SMP.RESOLVER "too many requests")))]
threadDelay 1500000
SlotWaitMetrics {waits, waitTimeouts, waitMaxMs} <- readSlotWaitMetrics
(waits, waitTimeouts) `shouldBe` (1, 1)
waitMaxMs `shouldSatisfy` (\t -> t >= 300 && t < 1000)
where
rslvErr :: Text -> Either SMPClientError (Either ProxyClientError SMP.NameResponse)
rslvErr = Left . PCEProtocolError . SMP.NAME . SMP.RESOLVER
relayCfg port = updateCfg (withNames port memCfg2) $ \c ->
let aCfg = smpAgentCfg c
cCfg = smpCfg aCfg
nt = NetworkTimeout {backgroundTimeout = 300000, interactiveTimeout = 300000}
in c {serverResolverConcurrency = 1, prometheusInterval = Just 1, smpAgentCfg = aCfg {smpCfg = cCfg {networkConfig = (networkConfig cCfg) {tcpTimeout = nt}}}}
in c
{ serverResolverConcurrency = 1,
prometheusInterval = Just 1,
smpAgentCfg = aCfg {smpCfg = cCfg {networkConfig = (networkConfig cCfg) {tcpTimeout = nt}}}
}
testRslvForwarded :: HasTestEnv => IO ()
testRslvForwarded =