madara-alliance / madara

Madara is a powerful hybrid Starknet client written in Rust.
https://madara.build
Apache License 2.0
79 stars 31 forks source link

bug(tests): MadaraBackend::open_for_testing fn unavailable to tests #293

Open notlesh opened 1 month ago

notlesh commented 1 month ago

Is there an existing issue?

Description of bug

Running certain tests results in compilation errors similar to:

   Compiling mc-block-import v0.7.0 (/home/stephen/dev/msl/starkware/madara/crates/client/block_import)
error[E0599]: no function or associated item named `open_for_testing` found for struct `mc_db::MadaraBackend` in the current scope
   --> crates/client/block_import/src/verify_apply.rs:343:24
    |
343 |         MadaraBackend::open_for_testing(chain_config.clone())
    |                        ^^^^^^^^^^^^^^^^ function or associated item not found in `MadaraBackend

This is related to the testing feature flag not being passed to the crate. One workaround is to add a testing feature to the given crate such as:

testing = ["mc-db/testing"]

And then run tests with this feature, e.g.:

cargo test -p mc-block-import --features=testing

Steps to reproduce

Run cargo test -p mc-block-import from the project root directory.

Or attempt to run any tests in verify_apply.rs in VSCode.

notlesh commented 1 month ago

295 seems to fix this, but I have another concern: why don't the mc-block-import tests run with cargo test --all?