Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(pd): automated migration testing #4337

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/migration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
# Test suite to verify that migrations apply cleanly.
# References to the previous stable release's tag, e.g. `v0.76.0`,
# must be updated manually.
name: Migration test
on:
# For now, we'll run this on every PR, but it's slow (>20m).
pull_request:
# Run periodically to check for breakage.
schedule:
# 16:10 UTC is 9AM PT / 12PM ET.
- cron: "10 16 * * *"
jobs:
migration_test:
runs-on: buildjet-32vcpu-ubuntu-2204
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
lfs: true
fetch-tags: true
fetch-depth: 0

- name: Load rust cache
uses: astriaorg/[email protected]
with:
# Cache the git worktree for faster builds
workspaces: |
. -> ./target
./deployments/worktrees/v0.76.0 -> ./deployments/worktrees/v0.76.0/target

- name: Install cometbft binary
run: ./deployments/scripts/install-cometbft

- name: Install process-compose
run: >-
sh -c "$(curl --location https://raw.githubusercontent.com/F1bonacc1/process-compose/main/scripts/get-pc.sh)" --
-d -b ~/bin

- name: Run migration test
run: |
export PATH="$HOME/bin:$PATH"
./deployments/scripts/migration-test v0.76.0
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ deployments/relayer/configs/penumbra-local.json

# Logs, and other files from smoke tests
deployments/logs/
deployments/worktrees/
deployments/bin/
crates/bin/pcli/proposal.toml
phase1.bin
crates/test/migration-test/proposal.toml

# Memory profiler, via bytehound or otherwise
*.dat
Expand Down
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ members = [
"crates/util/tower-trace",
"crates/view",
"crates/wallet",
"tools/summonerd",
"tools/summonerd", "crates/test/migration-test",
]

# Config for 'cargo dist'
Expand Down
35 changes: 35 additions & 0 deletions crates/test/migration-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "migration-test"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name = "migration-test"
name = "penumbra-migration-test"

a nit, but this should probably have the same penumbra- prefix as other crates in the workspace.

description = "Integration test runner for evaluating Penumbra upgrades"
authors.workspace = true
edition.workspace = true
version.workspace = true
repository.workspace = true
homepage.workspace = true
license.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
# By default, don't enable migration-tests: require explicit opt-in via
# `--features migration-test`.
default = []
migration-test = []
Comment on lines +14 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 👍


[dependencies]
anyhow = {workspace = true}
directories = {workspace = true}
once_cell = {workspace = true}
penumbra-keys = {workspace = true, default-features = false}
serde = {workspace = true, features = ["derive"]}
serde_json = {workspace = true}
serde_with = {workspace = true, features = ["hex"]}
toml = {workspace = true, features = ["preserve_order"]}
tracing = {workspace = true}
tracing-subscriber = {workspace = true, features = ["env-filter", "ansi"]}

[dev-dependencies]
assert_cmd = {workspace = true}
predicates = "2.1"
regex = {workspace = true}
tempfile = {workspace = true}
Comment on lines +19 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[dependencies]
anyhow = {workspace = true}
directories = {workspace = true}
once_cell = {workspace = true}
penumbra-keys = {workspace = true, default-features = false}
serde = {workspace = true, features = ["derive"]}
serde_json = {workspace = true}
serde_with = {workspace = true, features = ["hex"]}
toml = {workspace = true, features = ["preserve_order"]}
tracing = {workspace = true}
tracing-subscriber = {workspace = true, features = ["env-filter", "ansi"]}
[dev-dependencies]
assert_cmd = {workspace = true}
predicates = "2.1"
regex = {workspace = true}
tempfile = {workspace = true}
[dev-dependencies]
anyhow = { workspace = true }
assert_cmd = { workspace = true }
directories = { workspace = true }
once_cell = { workspace = true }
penumbra-keys = { workspace = true, default-features = false }
predicates = "2.1"
regex = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
serde_with = { workspace = true, features = ["hex"] }
tempfile = { workspace = true }
toml = { workspace = true, features = ["preserve_order"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter", "ansi"] }

these should all be dev-dependencies, since this crate only contains tests.

otherwise, cargo build --package migration-test will mean building all of these crates, despite the main.rs being empty and the --features migration-test not being provided

410 changes: 410 additions & 0 deletions crates/test/migration-test/files/migration-allocations.csv

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions crates/test/migration-test/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
Comment on lines +1 to +3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn main() {
println!("Hello, world!");
}
//! This crate is used to group migration tests, this binary does not do anything.
fn main() {
println!("Hello, world!");
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this empty file was a little confusing for a moment, so a comment might help signal that this main.rs is only here as a stub.

Loading
Loading