Skip to content

Commit 44d47b4

Browse files
committed
tests(pd): automated migration testing
Adds intra-CI standalone testing of migration behavior. This can be run locally on developer workstations, and also in CI. The job is currently taking >20m, and requires a lot of disk space, but it's worth it for the assurance. Building on the smoke-test rewrite to use process-compose, let's script the migration process, so that we can test current HEAD of the monorepo against a prior tagged version, and validate that necessary migrations are in place. One possible approach is to fetch prebuilt binaries from uploaded artifacts on Github. That's fine for `pd`, but doesn't work for running the smoke tests, due to client/server incompatibility. Therefore we'll clone the entire repo in a git-ignored subdir, and build the old binaries there. Heavy, but reliable. Adds a new rust crate, strictly for running the migration-test suite of integration tests, which is very similar in nature to the already-existing network-integration tests AKA smoke tests. Copy/pastes a lot of code from the smokes, which we can always factor out into reusable utils, but not bothering with that right now. Refs #4323.
1 parent 319a3d9 commit 44d47b4

17 files changed

+1460
-7
lines changed

.github/workflows/migration.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# Test suite to verify that migrations apply cleanly.
3+
# References to the previous stable release's tag, e.g. `v0.76.0`,
4+
# must be updated manually.
5+
name: Migration test
6+
on:
7+
# For now, we'll run this on every PR, but it's slow (>20m).
8+
pull_request:
9+
# Run periodically to check for breakage.
10+
schedule:
11+
# 16:10 UTC is 9AM PT / 12PM ET.
12+
- cron: "10 16 * * *"
13+
jobs:
14+
migration_test:
15+
runs-on: buildjet-32vcpu-ubuntu-2204
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
lfs: true
23+
fetch-tags: true
24+
fetch-depth: 0
25+
26+
- name: Load rust cache
27+
uses: astriaorg/[email protected]
28+
with:
29+
# Cache the git worktree for faster builds
30+
workspaces: |
31+
. -> ./target
32+
./deployments/worktrees/v0.76.0 -> ./deployments/worktrees/v0.76.0/target
33+
34+
- name: Install cometbft binary
35+
run: ./deployments/scripts/install-cometbft
36+
37+
- name: Install process-compose
38+
run: >-
39+
sh -c "$(curl --location https://raw.githubusercontent.com/F1bonacc1/process-compose/main/scripts/get-pc.sh)" --
40+
-d -b ~/bin
41+
42+
- name: Run migration test
43+
run: |
44+
export PATH="$HOME/bin:$PATH"
45+
./deployments/scripts/migration-test v0.76.0

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ deployments/relayer/configs/penumbra-local.json
5252

5353
# Logs, and other files from smoke tests
5454
deployments/logs/
55+
deployments/worktrees/
56+
deployments/bin/
5557
crates/bin/pcli/proposal.toml
5658
phase1.bin
59+
crates/test/migration-test/proposal.toml
5760

5861
# Memory profiler, via bytehound or otherwise
5962
*.dat

Cargo.lock

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ members = [
5252
"crates/util/tower-trace",
5353
"crates/view",
5454
"crates/wallet",
55-
"tools/summonerd",
55+
"tools/summonerd", "crates/test/migration-test",
5656
]
5757

5858
# Config for 'cargo dist'

crates/test/migration-test/Cargo.toml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[package]
2+
name = "migration-test"
3+
description = "Integration test runner for evaluating Penumbra upgrades"
4+
authors.workspace = true
5+
edition.workspace = true
6+
version.workspace = true
7+
repository.workspace = true
8+
homepage.workspace = true
9+
license.workspace = true
10+
11+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
12+
13+
[features]
14+
# By default, don't enable migration-tests: require explicit opt-in via
15+
# `--features migration-test`.
16+
default = []
17+
migration-test = []
18+
19+
[dependencies]
20+
anyhow = {workspace = true}
21+
directories = {workspace = true}
22+
once_cell = {workspace = true}
23+
penumbra-keys = {workspace = true, default-features = false}
24+
serde = {workspace = true, features = ["derive"]}
25+
serde_json = {workspace = true}
26+
serde_with = {workspace = true, features = ["hex"]}
27+
toml = {workspace = true, features = ["preserve_order"]}
28+
tracing = {workspace = true}
29+
tracing-subscriber = {workspace = true, features = ["env-filter", "ansi"]}
30+
31+
[dev-dependencies]
32+
assert_cmd = {workspace = true}
33+
predicates = "2.1"
34+
regex = {workspace = true}
35+
tempfile = {workspace = true}

crates/test/migration-test/files/migration-allocations.csv

+410
Large diffs are not rendered by default.
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("Hello, world!");
3+
}

0 commit comments

Comments
 (0)