Skip to content

Commit f844d38

Browse files
authored
feat(makefile): add test-env target for test setup (#3213)
Add a `test-env` Makefile target to streamline local test environment setup using `scripts/setup_test_env.sh`. Update README to document the new workflow, clarify terminology by consistently referring to the persistent environment as a "testnet cluster," and improve step-by-step instructions for repeated testing workflows.
1 parent 5c41fdc commit f844d38

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ reinstall-editable:
1717
fi
1818
@./scripts/clusterlib_reinstall_editable.sh "$(repo)"
1919

20+
# set up test environment
21+
.PHONY: test-env
22+
test-env:
23+
@if [ -z "$(era)" ]; then \
24+
echo "Usage: make test-env era=conway" >&2; \
25+
exit 1; \
26+
fi
27+
@./scripts/setup_test_env.sh "$(era)"
28+
2029
# initialize linters
2130
.PHONY: init_lint
2231
init_lint:

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Run tests easily using GitHub Actions:
4141
./.github/regression.sh
4242
```
4343

44-
> ℹ️ **NOTE:** Using `CI_BYRON_CLUSTER` will cause the local cluster to progress from Byron ➝ Conway, which takes approximately 40 minutes.
44+
> ℹ️ **NOTE:** Using `CI_BYRON_CLUSTER` will cause the local testnet cluster to progress from Byron ➝ Conway, which takes approximately 40 minutes.
4545
4646
---
4747

@@ -65,49 +65,49 @@ Run tests easily using GitHub Actions:
6565

6666
---
6767

68-
## 🔁 Persistent Local Cluster for Repeated Testing
68+
## 🔁 Persistent Local Testnet for Repeated Testing
6969

70-
For workflows requiring repeated test runs on a persistent cluster:
70+
For workflows requiring repeated test runs on a persistent testnet cluster:
7171

7272
1. Start a Nix shell:
7373

7474
```sh
7575
nix flake update --accept-flake-config --override-input cardano-node github:IntersectMBO/cardano-node/master
7676
nix develop --accept-flake-config
77+
/bin/bash --login # fresh shell needed
7778
```
7879

79-
2. Prepare the test environment:
80+
2. Set up the local test environment:
81+
82+
```sh
83+
make test-env era=conway
84+
```
85+
86+
3. Activate the environment:
8087

8188
```sh
82-
./scripts/setup_test_env.sh conway
8389
source ./dev_workdir/.source
8490
```
8591

86-
3. Launch the cluster:
92+
4. Launch the local testnet cluster:
8793

8894
```sh
8995
./dev_workdir/conway_fast/start-cluster
9096
```
9197

92-
4. Run your tests:
98+
5. Run your tests:
9399

94100
```sh
95101
pytest -s -k test_minting_one_token cardano_node_tests/tests/tests_plutus
96102
pytest -s --log-level=debug -k test_minting_one_token cardano_node_tests/tests/tests_plutus
97103
```
98104

99-
5. Stop the cluster:
105+
6. Stop the testnet cluster:
100106

101107
```sh
102108
./dev_workdir/conway_fast/stop-cluster
103109
```
104110

105-
To reuse the same environment in another shell:
106-
107-
```sh
108-
source ./dev_workdir/.source
109-
```
110-
111111
---
112112

113113
## ⚙️ Test Configuration Variables
@@ -186,7 +186,7 @@ cd ../cardano-node-tests
186186
source .source.dev
187187
```
188188

189-
### 🧱 Start Development Cluster
189+
### 🧱 Start Development Testnet Cluster
190190

191191
```sh
192192
prepare-cluster-scripts -c -d dev_workdir/conway_fast -t conway_fast

scripts/setup_test_env.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export DEV_CLUSTER_RUNNING=1
5454
export CLUSTERS_COUNT=1
5555
export FORBID_RESTART=1
5656
export NO_ARTIFACTS=1
57-
export CLUSTER_ERA="${CLUSTER_ERA:-""}"
58-
export COMMAND_ERA="${COMMAND_ERA:-""}"
57+
export CLUSTER_ERA="${CLUSTER_ERA:-}"
58+
export COMMAND_ERA="${COMMAND_ERA:-}"
5959
EoF
6060

6161
# shellcheck disable=SC1091

0 commit comments

Comments
 (0)