Skip to content

Commit 6aa375c

Browse files
authored
Merge pull request #5954 from IntersectMBO/smelc/small-improvements-cardano-testnet
cardano-testnet: small improvements
2 parents 733cd8b + 3a5ef35 commit 6aa375c

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

cardano-testnet/src/Testnet/Components/Configuration.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Testnet.Components.Configuration
1414
, getByronGenesisHash
1515
, getShelleyGenesisHash
1616

17-
, NumPools
17+
, NumPools(..)
1818
, numPools
1919
, NumDReps
2020
, numDReps

cardano-testnet/src/Testnet/Process/Run.hs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,11 @@ data ExecutableError
312312
= CannotDecodePlanJSON FilePath String
313313
| RetrievePlanJsonFailure IOException
314314
| ReadFileFailure IOException
315-
| MissingExecutable FilePath String
315+
| ExecutableMissingInComponent FilePath String
316+
-- ^ Component with key @component-name@ is found, but it is missing
317+
-- the @bin-file@ key.
318+
| ExecutableNotFoundInPlan String
319+
-- ^ Component with key @component-name@ cannot be found
316320
deriving Show
317321

318322

@@ -333,8 +337,8 @@ binDist pkg = do
333337
Right plan -> case List.filter matching (plan & installPlan) of
334338
(component:_) -> case component & binFile of
335339
Just bin -> return $ addExeSuffix (Text.unpack bin)
336-
Nothing -> left $ MissingExecutable pJsonFp $ "missing bin-file in: " <> show component
337-
[] -> error $ "Cannot find exe:" <> pkg <> " in plan"
340+
Nothing -> left $ ExecutableMissingInComponent pJsonFp $ "missing \"bin-file\" key in plan component: " <> show component
341+
[] -> left $ ExecutableNotFoundInPlan $ "Cannot find \"component-name\" key with value \"exe:" <> pkg <> "\""
338342
Left message -> left $ CannotDecodePlanJSON pJsonFp $ "Cannot decode plan: " <> message
339343
where matching :: Component -> Bool
340344
matching component = case componentName component of

cardano-testnet/src/Testnet/Property/Assert.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import Data.Type.Equality
4040
import Data.Word (Word8)
4141
import GHC.Stack as GHC
4242

43+
import Testnet.Components.Configuration (NumPools(..), numPools)
4344
import Testnet.Process.Run
4445
import Testnet.Start.Types
4546

@@ -87,7 +88,7 @@ assertExpectedSposInLedgerState
8788
-> ExecConfig
8889
-> m ()
8990
assertExpectedSposInLedgerState output tNetOptions execConfig = withFrozenCallStack $ do
90-
let numExpectedPools = length $ cardanoNodes tNetOptions
91+
let NumPools numExpectedPools = numPools tNetOptions
9192

9293
void $ execCli' execConfig
9394
[ "query", "stake-pools"

0 commit comments

Comments
 (0)