View on GitHub
File Changes
        nl' = toWLBlock <$> nl

                      
    stakePoolLayer
-
        :: Monad poolDBMonad
-
        => Trace IO Text
+
        :: Trace IO Text
        -> NetworkLayer IO t J.Block
-
        -> Pool.DBLayer poolDBMonad
+
        -> Pool.DBLayer IO
        -> IO (StakePoolLayer IO)
    stakePoolLayer trRoot nl db = do
        void $ forkFinally (monitorStakePools tr' nl' db) onExit
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE LambdaCase #-}
+
{-# LANGUAGE NamedFieldPuns #-}
module Cardano.Pool.MetricsSpec where

                      
import Prelude
    ( defaultConfigStdout )
import Cardano.BM.Trace
    ( nullTracer )
+
import Cardano.Pool.DB
+
    ( DBLayer (..) )
import Cardano.Pool.Metrics
    ( monitorStakePools )
import Cardano.Wallet.Jormungandr
import Test.Integration.Framework.DSL
    ( eventually )

                      
-
import qualified Cardano.Pool.DB as Pool
import qualified Cardano.Pool.DB.Sqlite as Pool

                      
spec :: Spec
    -- | Intended as "read all pool productions from the db". Oldest first, the
    -- tip last. In practice only reads the 10000 latest, but in this module we
    -- expect the dbs to contain ~10 slots, so it doesn't matter.
-
    readSlots :: Pool.DBLayer IO -> IO [SlotId]
-
    readSlots x = map slotId <$> Pool.readPoolProductionCursor x 10000
+
    readSlots :: DBLayer IO -> IO [SlotId]
+
    readSlots DBLayer{atomically, readPoolProductionCursor} =
+
        map slotId <$> atomically (readPoolProductionCursor 10000)

                      
    withMonitorStakePoolsThread nl db action = do
        bracket