Skip to content

Commit 31111cb

Browse files
Add nodeCanSupportMultipleEtcdClusters test
1 parent c0e78fe commit 31111cb

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

hydra-cluster/src/Hydra/Cluster/Scenarios.hs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,29 @@ threeNodesNoErrorsOnOpen tracer tmpDir node@RunningNode{nodeSocket} hydraScripts
10961096
Right _headIsOpen ->
10971097
pure ()
10981098

1099+
-- | Hydra nodes ABC run and connect to each other.
1100+
-- Hydra nodes ABC shut down.
1101+
-- Hydra nodes AB run and connect to each other.
1102+
-- Hydra nodes AB shut down.
1103+
-- Hydra nodes ABC run and connect to each other.
1104+
nodeCanSupportMultipleEtcdClusters :: Tracer IO EndToEndLog -> FilePath -> RunningNode -> [TxId] -> IO ()
1105+
nodeCanSupportMultipleEtcdClusters tracer tmpDir RunningNode{nodeSocket} hydraScriptsTxId = do
1106+
aliceKeys <- generate genKeyPair
1107+
bobKeys <- generate genKeyPair
1108+
carolKeys <- generate genKeyPair
1109+
1110+
let cardanoKeysABC = [aliceKeys, bobKeys, carolKeys]
1111+
hydraKeysABC = [aliceSk, bobSk, carolSk]
1112+
let cardanoKeysAB = [aliceKeys, bobKeys]
1113+
hydraKeysAB = [aliceSk, bobSk]
1114+
1115+
let contestationPeriod = UnsafeContestationPeriod 2
1116+
let depositDeadline = UnsafeDepositDeadline 50
1117+
let hydraTracer = contramap FromHydraNode tracer
1118+
withHydraCluster hydraTracer tmpDir nodeSocket 1 cardanoKeysABC hydraKeysABC hydraScriptsTxId contestationPeriod depositDeadline $ \clients -> waitForNodesConnected hydraTracer 20 clients
1119+
withHydraCluster hydraTracer tmpDir nodeSocket 1 cardanoKeysAB hydraKeysAB hydraScriptsTxId contestationPeriod depositDeadline $ \clients -> waitForNodesConnected hydraTracer 20 clients
1120+
withHydraCluster hydraTracer tmpDir nodeSocket 1 cardanoKeysABC hydraKeysABC hydraScriptsTxId contestationPeriod depositDeadline $ \clients -> waitForNodesConnected hydraTracer 20 clients
1121+
10991122
-- | Two hydra node setup where Alice is wrongly configured to use Carol's
11001123
-- cardano keys instead of Bob's which will prevent him to be notified the
11011124
-- `HeadIsInitializing` but he should still receive some notification.

hydra-cluster/test/Test/EndToEndSpec.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import Hydra.Cluster.Scenarios (
6060
checkFanout,
6161
headIsInitializingWith,
6262
initWithWrongKeys,
63+
nodeCanSupportMultipleEtcdClusters,
6364
nodeReObservesOnChainTxs,
6465
oneOfThreeNodesStopsForAWhile,
6566
persistenceCanLoadWithEmptyCommit,
@@ -282,6 +283,13 @@ spec = around (showLogsOnFailure "EndToEndSpec") $ do
282283
publishHydraScriptsAs node Faucet
283284
>>= threeNodesNoErrorsOnOpen tracer tmpDir node
284285

286+
it "node can support multiple etcd clusters" $ \tracer ->
287+
failAfter 60 $
288+
withClusterTempDir $ \tmpDir -> do
289+
withCardanoNodeDevnet (contramap FromCardanoNode tracer) tmpDir $ \node -> do
290+
publishHydraScriptsAs node Faucet
291+
>>= nodeCanSupportMultipleEtcdClusters tracer tmpDir node
292+
285293
it "inits a Head, processes a single Cardano transaction and closes it again" $ \tracer ->
286294
failAfter 60 $
287295
withClusterTempDir $ \tmpDir -> do

0 commit comments

Comments
 (0)