Skip to content

Commit df28a6f

Browse files
committed
Ensure upgrade test uses the correct binary on restart (#2478)
1 parent 971c120 commit df28a6f

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ concurrency:
2121

2222
env:
2323
go_version: '~1.20.12'
24+
tmpnet_data_path: ~/.tmpnet/networks/1000
2425

2526
jobs:
2627
Unit:
@@ -72,8 +73,9 @@ jobs:
7273
uses: actions/upload-artifact@v3
7374
if: always()
7475
with:
75-
name: e2e-artifact
76-
path: ~/.tmpnet/networks/1000
76+
name: e2e-tmpnet-data
77+
path: ${{ env.tmpnet_data_path }}
78+
if-no-files-found: error
7779
e2e_existing_network:
7880
runs-on: ubuntu-latest
7981
steps:
@@ -92,8 +94,9 @@ jobs:
9294
uses: actions/upload-artifact@v3
9395
if: always()
9496
with:
95-
name: e2e-existing-network-tmpnet-artifact
96-
path: ~/.tmpnet/networks/1000
97+
name: e2e-existing-network-tmpnet-data
98+
path: ${{ env.tmpnet_data_path }}
99+
if-no-files-found: error
97100
Upgrade:
98101
runs-on: ubuntu-latest
99102
steps:
@@ -107,15 +110,14 @@ jobs:
107110
run: ./scripts/build.sh
108111
- name: Run e2e tests
109112
shell: bash
110-
# 1.10.7 is the first version compatible with the ephnet fixture by
111-
# virtue of writing a process context file on node start.
112-
run: ./scripts/tests.upgrade.sh 1.10.7
113-
- name: Upload ephnet network dir
113+
run: ./scripts/tests.upgrade.sh
114+
- name: Upload tmpnet network dir
114115
uses: actions/upload-artifact@v3
115116
if: always()
116117
with:
117-
name: upgrade-artifact
118-
path: ~/.ephnet/networks/1000
118+
name: upgrade-tmpnet-data
119+
path: ${{ env.tmpnet_data_path }}
120+
if-no-files-found: error
119121
Lint:
120122
runs-on: ubuntu-latest
121123
steps:

scripts/tests.upgrade.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,21 @@
33
set -euo pipefail
44

55
# e.g.,
6-
# ./scripts/tests.upgrade.sh 1.7.16
7-
# AVALANCHEGO_PATH=./path/to/avalanchego ./scripts/tests.upgrade.sh 1.7.16 # Customization of avalanchego path
6+
# ./scripts/tests.upgrade.sh # Use default version
7+
# ./scripts/tests.upgrade.sh 1.10.18 # Specify a version
8+
# AVALANCHEGO_PATH=./path/to/avalanchego ./scripts/tests.upgrade.sh 1.10.18 # Customization of avalanchego path
89
if ! [[ "$0" =~ scripts/tests.upgrade.sh ]]; then
910
echo "must be run from repository root"
1011
exit 255
1112
fi
1213

13-
VERSION="${1:-}"
14+
# 1.10.17 is the first version compatible with bls signing keys being
15+
# included in the genesis. Attempting to upgrade from prior versions
16+
# will result in nodes failing to boot due to the hash of the genesis
17+
# not matching the hash of the committed genesis block.
18+
DEFAULT_VERSION="1.10.17"
19+
20+
VERSION="${1:-${DEFAULT_VERSION}}"
1421
if [[ -z "${VERSION}" ]]; then
1522
echo "Missing version argument!"
1623
echo "Usage: ${0} [VERSION]" >>/dev/stderr

tests/upgrade/upgrade_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ var _ = ginkgo.Describe("[Upgrade]", func() {
6969
node.Flags[config.BootstrapIPsKey] = strings.Join(bootstrapIPs, ",")
7070
require.NoError(node.WriteConfig())
7171

72-
require.NoError(node.Start(ginkgo.GinkgoWriter, avalancheGoExecPath))
72+
// Ensure the new node starts with the upgrade binary
73+
node.ExecPath = avalancheGoExecPathToUpgradeTo
74+
require.NoError(node.Start(ginkgo.GinkgoWriter, "" /* defaultExecPath */))
7375

7476
ginkgo.By(fmt.Sprintf("waiting for node %q to report healthy after restart", node.GetID()))
7577
e2e.WaitForHealthy(node)

0 commit comments

Comments
 (0)