@aztec/end-to-end 0.0.1-commit.d431d1c → 0.0.1-commit.e310a4c8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +28 -13
- package/dest/bench/utils.d.ts +5 -4
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +9 -7
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +7 -8
- package/dest/e2e_epochs/epochs_test.d.ts +7 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +29 -7
- package/dest/e2e_fees/bridging_race.notest.js +1 -1
- package/dest/e2e_fees/fees_test.d.ts +1 -1
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +6 -6
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +1 -7
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +2 -2
- package/dest/e2e_p2p/p2p_network.d.ts +1 -1
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +6 -2
- package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/e2e_p2p/reqresp/utils.js +153 -0
- package/dest/e2e_p2p/shared.d.ts +6 -6
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +9 -16
- package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +3 -3
- package/dest/fixtures/e2e_prover_test.d.ts +1 -1
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +8 -5
- package/dest/fixtures/setup.d.ts +5 -3
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +31 -20
- package/dest/fixtures/setup_p2p_test.d.ts +4 -5
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +24 -19
- package/dest/fixtures/token_utils.d.ts +1 -1
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +7 -4
- package/dest/shared/cross_chain_test_harness.d.ts +3 -4
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +11 -11
- package/dest/shared/gas_portal_test_harness.js +1 -1
- package/dest/shared/submit-transactions.d.ts +3 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +9 -11
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +12 -12
- package/dest/simulators/lending_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +1 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +61 -34
- package/dest/spartan/tx_metrics.d.ts +38 -2
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +178 -4
- package/dest/spartan/utils/bot.d.ts +27 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +141 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +36 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +20 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +9 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +18 -0
- package/dest/spartan/utils/k8s.d.ts +126 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +375 -0
- package/dest/spartan/utils/nodes.d.ts +41 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/scripts.d.ts +16 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +66 -0
- package/dest/spartan/utils.d.ts +2 -260
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -942
- package/package.json +39 -39
- package/src/bench/client_flows/client_flows_benchmark.ts +11 -24
- package/src/bench/utils.ts +9 -7
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +9 -12
- package/src/e2e_epochs/epochs_test.ts +58 -32
- package/src/e2e_fees/bridging_race.notest.ts +1 -4
- package/src/e2e_fees/fees_test.ts +10 -14
- package/src/e2e_l1_publisher/write_json.ts +3 -8
- package/src/e2e_nested_contract/nested_contract_test.ts +2 -4
- package/src/e2e_p2p/p2p_network.ts +15 -9
- package/src/e2e_p2p/reqresp/utils.ts +207 -0
- package/src/e2e_p2p/shared.ts +20 -22
- package/src/e2e_token_contract/token_contract_test.ts +3 -5
- package/src/fixtures/e2e_prover_test.ts +4 -9
- package/src/fixtures/setup.ts +33 -26
- package/src/fixtures/setup_p2p_test.ts +15 -20
- package/src/fixtures/token_utils.ts +6 -5
- package/src/shared/cross_chain_test_harness.ts +13 -27
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/submit-transactions.ts +9 -15
- package/src/shared/uniswap_l1_l2.ts +12 -19
- package/src/simulators/lending_simulator.ts +2 -2
- package/src/spartan/setup_test_wallets.ts +72 -24
- package/src/spartan/tx_metrics.ts +152 -7
- package/src/spartan/utils/bot.ts +185 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +26 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +64 -0
- package/src/spartan/utils/k8s.ts +527 -0
- package/src/spartan/utils/nodes.ts +538 -0
- package/src/spartan/utils/scripts.ts +63 -0
- package/src/spartan/utils.ts +1 -1246
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
3
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
4
|
+
import type { ViemPublicClient } from '@aztec/ethereum/types';
|
|
5
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
6
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
7
|
+
|
|
8
|
+
import { createPublicClient, fallback, http } from 'viem';
|
|
9
|
+
|
|
10
|
+
import { type ServiceEndpoint, getEthereumEndpoint, getRPCEndpoint } from './k8s.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Snapshot of chain state captured during setup for comparison in teardown.
|
|
14
|
+
*/
|
|
15
|
+
export interface ChainHealthSnapshot {
|
|
16
|
+
blockNumber: number;
|
|
17
|
+
checkpointNumber: CheckpointNumber;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Pre-flight and post-flight health checks for the Aztec network.
|
|
23
|
+
*
|
|
24
|
+
* Use in beforeAll/afterAll to validate the chain is healthy before tests run
|
|
25
|
+
* and verify it continued progressing during the test.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const health = new ChainHealth(config.NAMESPACE, logger);
|
|
30
|
+
*
|
|
31
|
+
* beforeAll(async () => {
|
|
32
|
+
* await health.setup();
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* afterAll(async () => {
|
|
36
|
+
* await health.teardown();
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export class ChainHealth {
|
|
41
|
+
private namespace: string;
|
|
42
|
+
private logger: Logger;
|
|
43
|
+
private snapshot?: ChainHealthSnapshot;
|
|
44
|
+
|
|
45
|
+
constructor(namespace: string, logger: Logger) {
|
|
46
|
+
this.namespace = namespace;
|
|
47
|
+
this.logger = logger;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Pre-flight health check. Validates chain is in a testable state and captures
|
|
52
|
+
* initial state for comparison in teardown.
|
|
53
|
+
*
|
|
54
|
+
* Checks performed:
|
|
55
|
+
* - Node is reachable and returns valid info
|
|
56
|
+
* - ENR exists
|
|
57
|
+
* - L1 is accessible
|
|
58
|
+
* - At least 1 L2 block has been mined
|
|
59
|
+
* - Committee exists
|
|
60
|
+
* - At least 1 checkpoint has been reached
|
|
61
|
+
*
|
|
62
|
+
* @throws Error if any health check fails
|
|
63
|
+
*/
|
|
64
|
+
async setup(): Promise<void> {
|
|
65
|
+
const endpoints: ServiceEndpoint[] = [];
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
// Establish connections (LB or port-forward)
|
|
69
|
+
const rpcEndpoint = await getRPCEndpoint(this.namespace);
|
|
70
|
+
endpoints.push(rpcEndpoint);
|
|
71
|
+
|
|
72
|
+
const ethEndpoint = await getEthereumEndpoint(this.namespace);
|
|
73
|
+
endpoints.push(ethEndpoint);
|
|
74
|
+
|
|
75
|
+
const nodeUrl = rpcEndpoint.url;
|
|
76
|
+
const ethereumUrl = ethEndpoint.url;
|
|
77
|
+
|
|
78
|
+
// Create clients
|
|
79
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
80
|
+
|
|
81
|
+
// Check 1: Node is reachable
|
|
82
|
+
let nodeInfo;
|
|
83
|
+
try {
|
|
84
|
+
nodeInfo = await node.getNodeInfo();
|
|
85
|
+
} catch (err) {
|
|
86
|
+
throw new Error(`Health check failed: Node is not reachable at ${nodeUrl}. Error: ${err}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!nodeInfo) {
|
|
90
|
+
throw new Error('Health check failed: Node returned empty info');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Check 2: ENR exists (P2P identity)
|
|
94
|
+
if (!nodeInfo.enr || !nodeInfo.enr.startsWith('enr:-')) {
|
|
95
|
+
throw new Error(`Health check failed: Invalid or missing ENR. Got: ${nodeInfo.enr}`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Check 3: L1 is accessible
|
|
99
|
+
const chain = createEthereumChain([ethereumUrl], nodeInfo.l1ChainId);
|
|
100
|
+
const ethereumClient: ViemPublicClient = createPublicClient({
|
|
101
|
+
chain: chain.chainInfo,
|
|
102
|
+
transport: fallback([http(ethereumUrl, { batch: false })]),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
await ethereumClient.getBlockNumber();
|
|
107
|
+
} catch (err) {
|
|
108
|
+
throw new Error(`Health check failed: L1 is not accessible at ${ethereumUrl}. Error: ${err}`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Check 4: At least 1 L2 block mined
|
|
112
|
+
let l2BlockNumber;
|
|
113
|
+
try {
|
|
114
|
+
l2BlockNumber = await node.getBlockNumber();
|
|
115
|
+
} catch (err) {
|
|
116
|
+
throw new Error(`Health check failed: Could not get L2 block number. Error: ${err}`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (l2BlockNumber < 1) {
|
|
120
|
+
throw new Error(`Health check failed: No L2 blocks mined yet. Block number: ${l2BlockNumber}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Check 5: Committee exists
|
|
124
|
+
const rollup = new RollupContract(ethereumClient, nodeInfo.l1ContractAddresses.rollupAddress);
|
|
125
|
+
|
|
126
|
+
let committee;
|
|
127
|
+
try {
|
|
128
|
+
committee = await rollup.getCurrentEpochCommittee();
|
|
129
|
+
} catch (err) {
|
|
130
|
+
throw new Error(`Health check failed: Could not get committee. Error: ${err}`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (!committee || committee.length === 0) {
|
|
134
|
+
throw new Error('Health check failed: No committee exists. Validators may not be registered yet.');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Check 6: At least 1 checkpoint reached
|
|
138
|
+
let checkpointNumber;
|
|
139
|
+
try {
|
|
140
|
+
checkpointNumber = await rollup.getCheckpointNumber();
|
|
141
|
+
} catch (err) {
|
|
142
|
+
throw new Error(`Health check failed: Could not get checkpoint number. Error: ${err}`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (checkpointNumber < CheckpointNumber(1)) {
|
|
146
|
+
throw new Error(
|
|
147
|
+
`Health check failed: No checkpoint reached yet. Checkpoint number: ${checkpointNumber}. ` +
|
|
148
|
+
'The proving pipeline may not have completed a proof yet.',
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Capture snapshot for teardown comparison
|
|
153
|
+
this.snapshot = {
|
|
154
|
+
blockNumber: l2BlockNumber,
|
|
155
|
+
checkpointNumber,
|
|
156
|
+
timestamp: Date.now(),
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
this.logger.info('Pre-flight health check passed');
|
|
160
|
+
} finally {
|
|
161
|
+
endpoints.forEach(e => e.process?.kill());
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Post-flight health check. Verifies the chain continued progressing during the test.
|
|
167
|
+
*
|
|
168
|
+
* For tests that ran longer than the threshold, checks:
|
|
169
|
+
* - Block number increased since setup
|
|
170
|
+
* - Checkpoint number increased since setup
|
|
171
|
+
*
|
|
172
|
+
* For shorter tests, skips the check.
|
|
173
|
+
*
|
|
174
|
+
* @throws Error if chain did not progress
|
|
175
|
+
*/
|
|
176
|
+
async teardown(): Promise<void> {
|
|
177
|
+
if (!this.snapshot) {
|
|
178
|
+
this.logger.warn('Teardown called without setup - skipping chain progress check');
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const endpoints: ServiceEndpoint[] = [];
|
|
183
|
+
// Minimum test duration to check chain progression
|
|
184
|
+
const PROGRESS_CHECK_THRESHOLD_SECONDS = 120;
|
|
185
|
+
|
|
186
|
+
try {
|
|
187
|
+
const elapsedSeconds = Math.round((Date.now() - this.snapshot.timestamp) / 1000);
|
|
188
|
+
|
|
189
|
+
// Skip progress check for short tests
|
|
190
|
+
if (elapsedSeconds <= PROGRESS_CHECK_THRESHOLD_SECONDS) {
|
|
191
|
+
this.logger.info('Post-flight health check passed (skipped progress check - test too short)');
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const rpcEndpoint = await getRPCEndpoint(this.namespace);
|
|
196
|
+
endpoints.push(rpcEndpoint);
|
|
197
|
+
|
|
198
|
+
const ethEndpoint = await getEthereumEndpoint(this.namespace);
|
|
199
|
+
endpoints.push(ethEndpoint);
|
|
200
|
+
|
|
201
|
+
const nodeUrl = rpcEndpoint.url;
|
|
202
|
+
const ethereumUrl = ethEndpoint.url;
|
|
203
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
204
|
+
|
|
205
|
+
// Check that block number increased
|
|
206
|
+
let currentBlockNumber;
|
|
207
|
+
try {
|
|
208
|
+
currentBlockNumber = await node.getBlockNumber();
|
|
209
|
+
} catch (err) {
|
|
210
|
+
throw new Error(`Teardown health check failed: Could not get block number. Error: ${err}`);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (currentBlockNumber <= this.snapshot.blockNumber) {
|
|
214
|
+
throw new Error(
|
|
215
|
+
`Chain did not progress during test. ` +
|
|
216
|
+
`Block number at setup: ${this.snapshot.blockNumber}, ` +
|
|
217
|
+
`Block number at teardown: ${currentBlockNumber}, ` +
|
|
218
|
+
`Elapsed time: ${elapsedSeconds}s. ` +
|
|
219
|
+
`The chain may have stalled during the test.`,
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Check that checkpoint number increased
|
|
224
|
+
const nodeInfo = await node.getNodeInfo();
|
|
225
|
+
const chain = createEthereumChain([ethereumUrl], nodeInfo.l1ChainId);
|
|
226
|
+
const ethereumClient: ViemPublicClient = createPublicClient({
|
|
227
|
+
chain: chain.chainInfo,
|
|
228
|
+
transport: fallback([http(ethereumUrl, { batch: false })]),
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
const rollup = new RollupContract(ethereumClient, nodeInfo.l1ContractAddresses.rollupAddress);
|
|
232
|
+
let currentCheckpoint;
|
|
233
|
+
try {
|
|
234
|
+
currentCheckpoint = await rollup.getCheckpointNumber();
|
|
235
|
+
} catch (err) {
|
|
236
|
+
throw new Error(`Teardown health check failed: Could not get checkpoint number. Error: ${err}`);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (currentCheckpoint <= this.snapshot.checkpointNumber) {
|
|
240
|
+
throw new Error(
|
|
241
|
+
`Proving pipeline did not progress during test. ` +
|
|
242
|
+
`Checkpoint at setup: ${this.snapshot.checkpointNumber}, ` +
|
|
243
|
+
`Checkpoint at teardown: ${currentCheckpoint}, ` +
|
|
244
|
+
`Elapsed time: ${elapsedSeconds}s. ` +
|
|
245
|
+
`The proving pipeline may have stalled during the test.`,
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
this.logger.info('Post-flight health check passed');
|
|
250
|
+
} finally {
|
|
251
|
+
endpoints.forEach(e => e.process?.kill());
|
|
252
|
+
this.snapshot = undefined;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
3
|
+
|
|
4
|
+
import { exec } from 'child_process';
|
|
5
|
+
import { promisify } from 'util';
|
|
6
|
+
|
|
7
|
+
const execAsync = promisify(exec);
|
|
8
|
+
|
|
9
|
+
const logger = createLogger('e2e:k8s-utils');
|
|
10
|
+
|
|
11
|
+
function shellQuote(value: string) {
|
|
12
|
+
// Single-quote safe shell escaping: ' -> '\''
|
|
13
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function valuesToArgs(values: Record<string, string | number | boolean>) {
|
|
17
|
+
return Object.entries(values)
|
|
18
|
+
.map(([key, value]) =>
|
|
19
|
+
typeof value === 'number' || typeof value === 'boolean'
|
|
20
|
+
? `--set ${key}=${value}`
|
|
21
|
+
: `--set-string ${key}=${shellQuote(String(value))}`,
|
|
22
|
+
)
|
|
23
|
+
.join(' ');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function createHelmCommand({
|
|
27
|
+
instanceName,
|
|
28
|
+
helmChartDir,
|
|
29
|
+
namespace,
|
|
30
|
+
valuesFile,
|
|
31
|
+
timeout,
|
|
32
|
+
values,
|
|
33
|
+
reuseValues = false,
|
|
34
|
+
}: {
|
|
35
|
+
instanceName: string;
|
|
36
|
+
helmChartDir: string;
|
|
37
|
+
namespace: string;
|
|
38
|
+
valuesFile: string | undefined;
|
|
39
|
+
timeout: string;
|
|
40
|
+
values: Record<string, string | number | boolean>;
|
|
41
|
+
reuseValues?: boolean;
|
|
42
|
+
}) {
|
|
43
|
+
const valuesFileArgs = valuesFile ? `--values ${helmChartDir}/values/${valuesFile}` : '';
|
|
44
|
+
const reuseValuesArgs = reuseValues ? '--reuse-values' : '';
|
|
45
|
+
return `helm upgrade --install ${instanceName} ${helmChartDir} --namespace ${namespace} ${valuesFileArgs} ${reuseValuesArgs} --wait --timeout=${timeout} ${valuesToArgs(
|
|
46
|
+
values,
|
|
47
|
+
)}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function execHelmCommand(args: Parameters<typeof createHelmCommand>[0]) {
|
|
51
|
+
const helmCommand = createHelmCommand(args);
|
|
52
|
+
logger.info(`helm command: ${helmCommand}`);
|
|
53
|
+
const { stdout } = await execAsync(helmCommand);
|
|
54
|
+
return stdout;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function getHelmReleaseStatus(instanceName: string, namespace: string): Promise<string | undefined> {
|
|
58
|
+
try {
|
|
59
|
+
const { stdout } = await execAsync(
|
|
60
|
+
`helm list --namespace ${namespace} --all --filter '^${instanceName}$' --output json | cat`,
|
|
61
|
+
);
|
|
62
|
+
const parsed = JSON.parse(stdout) as Array<{ name?: string; status?: string }>;
|
|
63
|
+
const row = parsed.find(r => r.name === instanceName);
|
|
64
|
+
return row?.status;
|
|
65
|
+
} catch {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export async function forceDeleteHelmReleaseRecord(instanceName: string, namespace: string, log?: Logger) {
|
|
71
|
+
const labelSelector = `owner=helm,name=${instanceName}`;
|
|
72
|
+
const cmd = `kubectl delete secret -n ${namespace} -l ${labelSelector} --ignore-not-found=true`;
|
|
73
|
+
(log ?? logger).warn(`Force deleting Helm release record: ${cmd}`);
|
|
74
|
+
await execAsync(cmd).catch(() => undefined);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function hasDeployedHelmRelease(instanceName: string, namespace: string): Promise<boolean> {
|
|
78
|
+
try {
|
|
79
|
+
const status = await getHelmReleaseStatus(instanceName, namespace);
|
|
80
|
+
return status?.toLowerCase() === 'deployed';
|
|
81
|
+
} catch {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Re-export all utilities from individual modules
|
|
2
|
+
// Note: Internal helpers (helm commands, etc.) are not re-exported to maintain the original public API
|
|
3
|
+
|
|
4
|
+
// Config
|
|
5
|
+
export { type TestConfig, setupEnvironment } from './config.js';
|
|
6
|
+
|
|
7
|
+
// Scripts
|
|
8
|
+
export { getGitProjectRoot, getAztecBin, runAztecBin, runProjectScript } from './scripts.js';
|
|
9
|
+
|
|
10
|
+
// K8s operations
|
|
11
|
+
export {
|
|
12
|
+
startPortForward,
|
|
13
|
+
getExternalIP,
|
|
14
|
+
startPortForwardForPrometeheus,
|
|
15
|
+
startPortForwardForRPC,
|
|
16
|
+
startPortForwardForEthereum,
|
|
17
|
+
deleteResourceByName,
|
|
18
|
+
deleteResourceByLabel,
|
|
19
|
+
waitForResourceByLabel,
|
|
20
|
+
waitForResourceByName,
|
|
21
|
+
waitForResourcesByName,
|
|
22
|
+
getChartDir,
|
|
23
|
+
type ServiceEndpoint,
|
|
24
|
+
getServiceEndpoint,
|
|
25
|
+
getRPCEndpoint,
|
|
26
|
+
getEthereumEndpoint,
|
|
27
|
+
createResilientPrometheusConnection,
|
|
28
|
+
} from './k8s.js';
|
|
29
|
+
|
|
30
|
+
// Chaos Mesh
|
|
31
|
+
export {
|
|
32
|
+
uninstallChaosMesh,
|
|
33
|
+
installChaosMeshChart,
|
|
34
|
+
applyProverFailure,
|
|
35
|
+
applyValidatorFailure,
|
|
36
|
+
applyProverKill,
|
|
37
|
+
applyProverBrokerKill,
|
|
38
|
+
applyBootNodeFailure,
|
|
39
|
+
applyValidatorKill,
|
|
40
|
+
applyNetworkShaping,
|
|
41
|
+
} from './chaos.js';
|
|
42
|
+
|
|
43
|
+
// Bot management
|
|
44
|
+
export { restartBot, installTransferBot, uninstallTransferBot } from './bot.js';
|
|
45
|
+
|
|
46
|
+
// Node operations (sequencers, validators, pods)
|
|
47
|
+
export {
|
|
48
|
+
awaitCheckpointNumber,
|
|
49
|
+
waitForProvenToAdvance,
|
|
50
|
+
getSequencers,
|
|
51
|
+
updateSequencersConfig,
|
|
52
|
+
getSequencersConfig,
|
|
53
|
+
withSequencersAdmin,
|
|
54
|
+
setValidatorTxDrop,
|
|
55
|
+
restartValidators,
|
|
56
|
+
enableValidatorDynamicBootNode,
|
|
57
|
+
rollAztecPods,
|
|
58
|
+
} from './nodes.js';
|
|
59
|
+
|
|
60
|
+
// Client utilities
|
|
61
|
+
export { getPublicViemClient, getL1DeploymentAddresses, getNodeClient } from './clients.js';
|
|
62
|
+
|
|
63
|
+
// Health checks
|
|
64
|
+
export { ChainHealth, type ChainHealthSnapshot } from './health.js';
|