Skip to content

Commit

Permalink
Extend prop_readPoolLifeCycleStatus.
Browse files Browse the repository at this point in the history
Extend `prop_readPoolLifeCycleStatus` to call `listRetiredPools`.
  • Loading branch information
jonathanknowles committed Aug 13, 2020
1 parent e539aa2 commit bf697df
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/core/test/unit/Cardano/Pool/DB/Properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import Cardano.Wallet.Primitive.Slotting
import Cardano.Wallet.Primitive.Types
( BlockHeader (..)
, CertificatePublicationTime (..)
, EpochNo
, EpochNo (..)
, PoolCertificate (..)
, PoolId
, PoolLifeCycleStatus (..)
Expand Down Expand Up @@ -659,6 +659,8 @@ prop_readPoolLifeCycleStatus
run $ atomically $ do
mapM_ (uncurry putCertificate) certificatePublications
readPoolLifeCycleStatus sharedPoolId
poolsMarkedToRetire <-
run $ atomically $ listRetiredPools $ EpochNo maxBound
monitor $ counterexample $ unlines
[ "\nFinal registration: "
, show mFinalRegistration
Expand All @@ -672,9 +674,19 @@ prop_readPoolLifeCycleStatus
, show (length certificatePublications)
, "\nAll certificate publications: "
, unlines (("\n" <>) . show <$> certificatePublications)
, "\nAll pools that are marked to retire: "
, unlines (("\n" <>) . show <$> poolsMarkedToRetire)
]
assertWith "actualStatus == expectedStatus"
(actualStatus == expectedStatus)
assertWith "pool is marked to retire only when appropriate" $
case actualStatus of
PoolNotRegistered ->
null poolsMarkedToRetire
PoolRegistered _regCert ->
null poolsMarkedToRetire
PoolRegisteredAndRetired _regCert retCert ->
poolsMarkedToRetire == [retCert]

certificatePublications :: [(CertificatePublicationTime, PoolCertificate)]
certificatePublications = publicationTimes `zip` certificates
Expand Down

0 comments on commit bf697df

Please sign in to comment.