refactor(testnets): align scripts with cardonnay style#3515
Merged
Conversation
Restructure the testnet cluster scripts to match the cardonnay common/local_fast style: split start-cluster into local functions, use UPPERCASE readonly globals, and reuse rm_retry, get_address_balance and create_cluster_scripts from common.sh. supervisor.conf is now generated inline by start-cluster instead of shipped as a static template, and declares a [group:nodes] group so the supervisorctl_restart_nodes helper applies to the relay. Convert cardano-node-relay1 and run-cardano-submit-api to args arrays with a compact PID log line, and add a command -v guard to run-cardano-submit-api. Drop run-cardano-dbsync: it is now identical to common's version, which is already provided in the final testnet directory. Fix the faucet balance call to not pass --testnet-magic twice, as common.sh get_address_balance now injects it. Keep the POSIX `cd "$(dirname "$0")" && pwd` directory resolution in start-cluster itself, while the scripts emitted by common's create_cluster_scripts use `readlink -m`.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the testnets cluster scripts to align with the “cardonnay common/local_fast” scripting style: splitting start-cluster into smaller functions, using UPPERCASE readonly globals, generating supervisor.conf inline, and switching node/service wrappers to args arrays.
Changes:
- Refactor
start-clusterintoinitialize_globals,setup_state_cluster,configure_supervisor, and service startup helpers; generatesupervisor.confat runtime and introduce[group:nodes]. - Convert
cardano-node-relay1andrun-cardano-submit-apito use bash argument arrays and print compact PID+command log lines; add acommand -vguard forcardano-submit-api. - Remove the static
supervisor.conftemplate and removerun-cardano-dbsyncfrom this directory.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cardano_node_tests/cluster_scripts/testnets/supervisor.conf | Removes the static supervisor configuration template (now generated inline by start-cluster). |
| cardano_node_tests/cluster_scripts/testnets/start-cluster | Refactors script into functions, generates supervisor config inline, and hooks into shared/common helpers for script creation and utilities. |
| cardano_node_tests/cluster_scripts/testnets/run-cardano-submit-api | Refactors wrapper to an args array, adds a guard for missing binary, and adjusts logging. |
| cardano_node_tests/cluster_scripts/testnets/run-cardano-dbsync | Removes the local db-sync wrapper script. |
| cardano_node_tests/cluster_scripts/testnets/dbsync_block_no.sh | Refactors variable handling to UPPERCASE readonly globals. |
| cardano_node_tests/cluster_scripts/testnets/cardano-node-relay1 | Refactors wrapper to an args array and adjusts logging. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restructure the testnet cluster scripts to match the cardonnay common/local_fast style: split start-cluster into local functions, use UPPERCASE readonly globals, and reuse rm_retry, get_address_balance and create_cluster_scripts from common.sh. supervisor.conf is now generated inline by start-cluster instead of shipped as a static template, and declares a [group:nodes] group so the supervisorctl_restart_nodes helper applies to the relay.
Convert cardano-node-relay1 and run-cardano-submit-api to args arrays with a compact PID log line, and add a command -v guard to run-cardano-submit-api.
Drop run-cardano-dbsync: it is now identical to common's version, which is already provided in the final testnet directory.
Fix the faucet balance call to not pass --testnet-magic twice, as common.sh get_address_balance now injects it.
Keep the POSIX
cd "$(dirname "$0")" && pwddirectory resolution in start-cluster itself, while the scripts emitted by common's create_cluster_scripts usereadlink -m.