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

fix(test): add retry to tests that do heavy downloading tasks #5274

Merged
merged 4 commits into from
Feb 12, 2025
Merged
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
8 changes: 5 additions & 3 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
[profile.default]
slow-timeout = { period = "10s", terminate-after = 3 }

# This test downloads bundles from the network, which can take a while.
# It is only run on CI, so we can afford to be more patient.
[[profile.default.overrides]]
filter = 'test(state_migration_actor_bundle_runs)'
filter = 'test(networks::actors_bundle::tests::check_bundles_are_mirrored)'
slow-timeout = { period = "120s", terminate-after = 3 }

# This test downloads bundles from the network, which can take a while.
# It is only run on CI, so we can afford to be more patient.
[[profile.default.overrides]]
filter = 'test(networks::actors_bundle::tests::check_bundles_are_mirrored)'
filter = 'test(state_migration_actor_bundle)'
slow-timeout = { period = "120s", terminate-after = 3 }

# This test downloads bundles from the network, which can take a while.
# It is only run on CI, so we can afford to be more patient.
[[profile.default.overrides]]
filter = 'test(create_manifest_json)'
filter = 'test(state_migration_generate_actors_metadata)'
slow-timeout = { period = "120s", terminate-after = 3 }

# This test downloads RPC test snapshot files from the network, which can take a while.
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ on:
# run when moved out of draft.
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- 'docs/**'
- '.github/workflows/docs-*.yml'
- "docs/**"
- ".github/workflows/docs-*.yml"
push:
branches:
- main
paths-ignore:
- 'docs/**'
- '.github/workflows/docs-*.yml'
- "docs/**"
- ".github/workflows/docs-*.yml"

env:
CI: 1
Expand Down Expand Up @@ -74,3 +74,6 @@ jobs:
- name: install nextest
uses: taiki-e/install-action@nextest
- run: make test-release
env:
# To minimize compile times: https://nnethercote.github.io/perf-book/build-configuration.html#minimizing-compile-times
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld"
110 changes: 92 additions & 18 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ cbor4ii = { version = "0.2", default-features = false, features = ["serde1"] }
criterion = { version = "0.5", features = ["async_tokio", "csv"] }
cs_serde_bytes = "0.12"
derive-quickcheck-arbitrary = "0.1"
fickle = "0.3"
fvm_shared3 = { package = "fvm_shared", version = "~3.12", features = ["arb", "proofs", "testing"] }
fvm_shared4 = { package = "fvm_shared", version = "~4.5.3", features = ["arb", "proofs", "testing"] }
glob = "0.3"
Expand All @@ -252,6 +253,7 @@ quickcheck_async = "0.1"
quickcheck_macros = "1"
ra_ap_syntax = "0.0.263"
regex-automata = "0.4"
serial_test = "3"
syn = { version = "2", default-features = false, features = ["full", "parsing", "visit", "printing", "extra-traits"] }
tokio-test = "0.4"

Expand Down
28 changes: 22 additions & 6 deletions tests/manifest_tests.rs → tests/cmd_state_migration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,32 @@
pub mod common;

use crate::common::tool;
use fickle::fickle;
use serial_test::serial;
use std::path::PathBuf;

#[test]
fn create_manifest_json() {
// This downloads lots of bundles from Github, which may be down at the time
// of local development. If GH is down, the CI will likely fail as well.
if std::env::var("CI").is_err() {
return;
}
#[fickle]
#[serial]
fn state_migration_actor_bundle() {
let temp_dir = tempfile::tempdir().unwrap();
let bundle = temp_dir.path().join("bundle.car");

tool()
.arg("state-migration")
.arg("actor-bundle")
.arg(&bundle)
.assert()
.success();

assert!(bundle.exists());
assert!(zstd::decode_all(std::fs::File::open(&bundle).unwrap()).is_ok());
}

#[test]
#[fickle]
#[serial]
fn state_migration_generate_actors_metadata() {
let json = tool()
.arg("state-migration")
.arg("generate-actors-metadata")
Expand Down
17 changes: 0 additions & 17 deletions tests/tool_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,6 @@ fn export_empty_archive() {
));
}

// Running `forest-tool state-migration actor-bundle` may not fail.
#[test]
fn state_migration_actor_bundle_runs() {
let temp_dir = tempfile::tempdir().unwrap();
let bundle = temp_dir.path().join("bundle.car");

tool()
.arg("state-migration")
.arg("actor-bundle")
.arg(&bundle)
.assert()
.success();

assert!(bundle.exists());
assert!(zstd::decode_all(std::fs::File::open(&bundle).unwrap()).is_ok());
}

#[test]
fn peer_id_from_keypair() {
let temp_dir = tempfile::tempdir().unwrap();
Expand Down
Loading