File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
mithril-test-lab/mithril-end-to-end/test/Test Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -82,10 +82,19 @@ assertClientCanVerifySnapshot workDir aggregator digest =
8282 void $ runClient workDir aggregator [" restore" , digest]
8383
8484assertNodeIsProducingSnapshot :: Tracer IO ClusterLog -> RunningNode -> Int -> IO Text
85- assertNodeIsProducingSnapshot _tracer _cardanoNode aggregatorPort = do
86- request <- parseRequest $ " http://localhost:" <> show aggregatorPort <> " /aggregator/certificate-pending"
87- CertificatePending {beacon} <- getResponseBody <$> httpJSON request
88- pure $ digestOf beacon
85+ assertNodeIsProducingSnapshot _tracer _cardanoNode aggregatorPort = go 10
86+ where
87+ go :: Int -> IO ()
88+ go 0 = failure " Timeout exhausted"
89+ go n = do
90+ request <- parseRequest $ " http://localhost:" <> show aggregatorPort <> " /aggregator/certificate-pending"
91+ response <- httpLBS request
92+ case getResponseStatusCode response of
93+ 204 -> threadDelay 1 >> go (n - 1 )
94+ 200 -> do
95+ CertificatePending {beacon} <- getResponseBody <$> httpJSON request
96+ pure $ digestOf beacon
97+ other -> failure $ " unexpected status code: " <> show other
8998
9099assertNetworkIsProducingBlock :: Tracer IO ClusterLog -> RunningCluster -> IO ()
91100assertNetworkIsProducingBlock tracer = failAfter 30 . go (- 1 )
You can’t perform that action at this time.
0 commit comments