|
16 | 16 |
|
17 | 17 | processes = {
|
18 | 18 | prepare-devnet = {
|
19 |
| - command = "${self}/demo/prepare-devnet.sh"; |
| 19 | + working_dir = "."; |
| 20 | + command = '' |
| 21 | + ${pkgs.bash}/bin/bash ${self}/demo/prepare-devnet.sh |
| 22 | + ''; |
20 | 23 | };
|
21 | 24 | cardano-node = {
|
| 25 | + working_dir = "."; |
22 | 26 | command = ''
|
23 | 27 | ${pkgs.cardano-node}/bin/cardano-node run \
|
24 | 28 | --config devnet/cardano-node.json \
|
|
33 | 37 | depends_on."prepare-devnet".condition = "process_completed";
|
34 | 38 | };
|
35 | 39 | seed-devnet = {
|
| 40 | + working_dir = "."; |
36 | 41 | command = ''
|
37 | 42 | ${self}/demo/seed-devnet.sh ${pkgs.cardano-cli}/bin/cardano-cli ${self'.packages.hydra-node}/bin/hydra-node
|
38 | 43 | '';
|
|
45 | 50 | checkPhase = ""; # not shellcheck and choke on sourcing .env
|
46 | 51 | text = ''
|
47 | 52 | # (Re-)Export all variables from .env
|
48 |
| - set -a; source .env; set +a |
| 53 | + set -a; [ -f .env ] && source .env; set +a |
49 | 54 | ${self'.packages.hydra-node}/bin/hydra-node \
|
50 | 55 | --node-id 1 \
|
51 | 56 | --listen 127.0.0.1:5001 \
|
|
67 | 72 | --contestation-period 3s
|
68 | 73 | '';
|
69 | 74 | };
|
| 75 | + working_dir = "."; |
70 | 76 | ready_log_line = "NodeIsLeader";
|
71 | 77 | depends_on."seed-devnet".condition = "process_completed";
|
72 | 78 | };
|
|
77 | 83 | checkPhase = ""; # not shellcheck and choke on sourcing .env
|
78 | 84 | text = ''
|
79 | 85 | # (Re-)Export all variables from .env
|
80 |
| - set -a; source .env; set +a |
| 86 | + set -a; [ -f .env ] && source .env; set +a |
81 | 87 | ${self'.packages.hydra-node}/bin/hydra-node \
|
82 | 88 | --node-id 2 \
|
83 | 89 | --listen 127.0.0.1:5002 \
|
|
99 | 105 | --contestation-period 3s
|
100 | 106 | '';
|
101 | 107 | };
|
| 108 | + working_dir = "."; |
102 | 109 | ready_log_line = "NodeIsLeader";
|
103 | 110 | depends_on."seed-devnet".condition = "process_completed";
|
104 | 111 | };
|
|
109 | 116 | checkPhase = ""; # not shellcheck and choke on sourcing .env
|
110 | 117 | text = ''
|
111 | 118 | # (Re-)Export all variables from .env
|
112 |
| - set -a; source .env; set +a |
| 119 | + set -a; [ -f .env ] && source .env; set +a |
113 | 120 | ${self'.packages.hydra-node}/bin/hydra-node \
|
114 | 121 | --node-id 3 \
|
115 | 122 | --listen 127.0.0.1:5003 \
|
|
131 | 138 | --contestation-period 3s
|
132 | 139 | '';
|
133 | 140 | };
|
| 141 | + working_dir = "."; |
134 | 142 | ready_log_line = "NodeIsLeader";
|
135 | 143 | depends_on."seed-devnet".condition = "process_completed";
|
136 | 144 | };
|
|
170 | 178 | is_foreground = true;
|
171 | 179 | depends_on."hydra-node-carol".condition = "process_started";
|
172 | 180 | };
|
| 181 | + test = { |
| 182 | + command = pkgs.writeShellApplication { |
| 183 | + name = "demo-test"; |
| 184 | + runtimeInputs = [ pkgs.coreutils pkgs.cardano-cli pkgs.cardano-node self'.packages.hydra-node ]; |
| 185 | + text = '' |
| 186 | + set -euo pipefail |
| 187 | + |
| 188 | + echo "--- Testing demo components" |
| 189 | + |
| 190 | + # Test that we can build and run basic components |
| 191 | + echo "Testing cardano-cli..." |
| 192 | + cardano-cli --version |
| 193 | + |
| 194 | + echo "Testing cardano-node..." |
| 195 | + cardano-node --version |
| 196 | + |
| 197 | + echo "✅ Demo setup completed successfully" |
| 198 | + |
| 199 | + echo "--- Testing that devnet files exist" |
| 200 | + if [ -f "devnet/cardano-node.json" ] && [ -f "devnet/topology.json" ]; then |
| 201 | + echo "✅ Devnet configuration files created" |
| 202 | + else |
| 203 | + echo "❌ Devnet configuration files missing" |
| 204 | + exit 1 |
| 205 | + fi |
| 206 | + |
| 207 | + echo "--- Testing hydra-node" |
| 208 | + hydra-node --version |
| 209 | + ''; |
| 210 | + }; |
| 211 | + # Ensure test starts only after devnet has been prepared |
| 212 | + depends_on."prepare-devnet".condition = "process_completed"; |
| 213 | + }; |
173 | 214 | };
|
174 | 215 | };
|
175 | 216 | };
|
|
0 commit comments