Skip to content

Commit

Permalink
Improve network spec by avoid writing the internal representation whe…
Browse files Browse the repository at this point in the history
…n saving acks

Instead, we can use the interface provided for 'the system under test', here: configureMessagePersistence.
  • Loading branch information
ffakenz committed Nov 27, 2023
1 parent 1191264 commit 3989d2b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hydra-node/test/Hydra/NetworkSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import Hydra.Logging (nullTracer, showLogsOnFailure)
import Hydra.Network (Host (..), Network)
import Hydra.Network.Message (Message (..))
import Hydra.Network.Ouroboros (broadcast, withOuroborosNetwork)
import Hydra.Node.Network (acksFile, configureMessagePersistence)
import Hydra.Network.Reliability (MessagePersistence (..))
import Hydra.Node.Network (configureMessagePersistence)
import Hydra.Node.ParameterMismatch (ParameterMismatch)
import Test.Aeson.GenericSpecs (roundtripAndGoldenSpecs)
import Test.Network.Ports (randomUnusedTCPPorts)
Expand Down Expand Up @@ -57,7 +58,8 @@ spec = do
describe "configureMessagePersistence" $ do
it "throws ParameterMismatch when configuring given number of acks does not match number of parties" $ do
withTempDir "persistence" $ \dir -> do
writeFile (acksFile dir) "[0,0,0]"
MessagePersistence{saveAcks} <- configureMessagePersistence @_ @Int nullTracer dir 3
saveAcks (fromList [0, 0, 0])
configureMessagePersistence @_ @Int nullTracer dir 4 `shouldThrow` (const True :: Selector ParameterMismatch)

withNodeBroadcastingForever :: Network IO Integer -> Integer -> IO b -> IO b
Expand Down

0 comments on commit 3989d2b

Please sign in to comment.