Skip to content

Commit

Permalink
Change timeout test execution
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienFT committed Nov 13, 2024
1 parent d0b7b43 commit d140df4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 41 deletions.
34 changes: 0 additions & 34 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion crates/services/upgradable-executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ wasmtime = { version = "23.0.2", default-features = false, features = [
anyhow = { workspace = true }
fuel-core-storage = { workspace = true, features = ["test-helpers"] }
fuel-core-types = { workspace = true, features = ["test-helpers"] }
ntest = "0.9.2"

[build-dependencies]
fuel-core-wasm-executor = { workspace = true, optional = true, default-features = false }
Expand Down
16 changes: 10 additions & 6 deletions crates/services/upgradable-executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,6 @@ where
#[allow(unexpected_cfgs)] // for cfg(coverage)
#[cfg(test)]
mod test {
#[cfg(coverage)]
use ntest as _; // Only used outside cdg(coverage)

use super::*;
use fuel_core_storage::{
kv_store::Value,
Expand Down Expand Up @@ -946,7 +943,6 @@ mod test {
mod native {
use super::*;
use crate::executor::Executor;
use ntest as _;

#[test]
fn can_validate_block() {
Expand Down Expand Up @@ -1111,18 +1107,22 @@ mod test {
// If it doesn't cache the modules, the test will fail with a timeout.
#[test]
#[cfg(not(coverage))] // Too slow for coverage
#[ntest::timeout(90_000)]
fn reuse_cached_compiled_module__native_strategy() {
// Given
let next_version = Executor::<Storage, DisabledRelayer>::VERSION + 1;
let storage = storage_with_state_transition(next_version);
let executor = Executor::native(storage, DisabledRelayer, Config::default());
let block = valid_block(next_version);

executor.validate(&block).map(|_| ()).unwrap();
let start = std::time::Instant::now();
// When
for _ in 0..1000 {
let result = executor.validate(&block).map(|_| ());

if start.elapsed().as_secs() > 60 {
panic!("The test is too slow");
}
// Then
assert_eq!(Ok(()), result);
}
Expand All @@ -1132,18 +1132,22 @@ mod test {
// If it doesn't cache the modules, the test will fail with a timeout.
#[test]
#[cfg(not(coverage))] // Too slow for coverage
#[ntest::timeout(90_000)]
fn reuse_cached_compiled_module__wasm_strategy() {
// Given
let next_version = Executor::<Storage, DisabledRelayer>::VERSION + 1;
let storage = storage_with_state_transition(next_version);
let executor = Executor::wasm(storage, DisabledRelayer, Config::default());
let block = valid_block(next_version);

executor.validate(&block).map(|_| ()).unwrap();
let start = std::time::Instant::now();
// When
for _ in 0..1000 {
let result = executor.validate(&block).map(|_| ());

if start.elapsed().as_secs() > 60 {
panic!("The test is too slow");
}
// Then
assert_eq!(Ok(()), result);
}
Expand Down

0 comments on commit d140df4

Please sign in to comment.