iotaledger/stronghold.rs

Test `test_create_snapshot_file_in_custom_directory` has non-deterministic behavior

vuongDang opened this issue · 1 comments

Bug description

The test tests::interface_tests::test_create_snapshot_file_in_custom_directory has non-deterministic behaviour
and fails randomly occasionally

Rust version

  • Rust version: 1.63.0

Stronghold version

  • Stronghold version (version number, commit, or branch): 0.9.1, dev

Hardware specification

  • Operating system: Ubuntu 20.04
  • RAM: 16G
  • Cores: 8

Steps To reproduce the bug

Run cargo test multiple times from the client/ directory, tests::interface_tests::test_create_snapshot_file_in_custom_directory fails from time to time
I believe it's important to run all the tests together and not this single test because I suspect that this non-deterministic behavior stems from the different tests messing with the file system concurrently

Expected behaviour

Deterministic behavior of the test

Actual behaviour

tests::interface_tests::test_create_snapshot_file_in_custom_directory fails randomly

Stack trace

I could not reproduce the error with RUST_BACKTRACE=full

---- tests::interface_tests::test_create_snapshot_file_in_custom_directory stdout ----
thread 'tests::interface_tests::test_create_snapshot_file_in_custom_directory' panicked at 'Failed to load client from snapshot (Err(SnapshotFileMissing("/tmp/idkfa.snapshot")))', client/src/tests/interface_tests.rs:422:5
stack backtrace:
0: rust_begin_unwind
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:142:14
2: iota_stronghold::tests::interface_tests::test_create_snapshot_file_in_custom_directory
at ./src/tests/interface_tests.rs:422:5
3: iota_stronghold::tests::interface_tests::test_create_snapshot_file_in_custom_directory::{{closure}}
at ./src/tests/interface_tests.rs:397:1
4: core::ops::function::FnOnce::call_once
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/ops/function.rs:248:5
5: core::ops::function::FnOnce::call_once
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/ops/function.rs:248:5

Is there a stack trace?