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

Disable MBT tests if the "mocks" feature is not enabled #643

Merged
merged 4 commits into from
Feb 12, 2021
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
18 changes: 4 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@
### BUG FIXES

- [ibc]
- [nothing yet]
- Fix panic in conn open try when no connection id is provided ([#626])
- Disable MBT tests if the "mocks" feature is not enabled ([#643])

- [ibc-relayer]
- [nothing yet]

- [ibc-relayer-cli]
- [nothing yet]
- Fix wrong acks sent with `tx raw packet-ack` in a 3-chain setup ([#614])

### BREAKING CHANGES

Expand All @@ -49,23 +50,12 @@
- [ibc-relayer-cli]
- [nothing yet]

### BUG FIXES

- [ibc]
- Fix panic in conn open try when no connection id is provided ([#626])

- [ibc-relayer]
- [nothing yet]

- [ibc-relayer-cli]
- Fix wrong acks sent with `tx raw packet-ack` in a 3-chain setup ([#614])


[#316]: https://github.com/informalsystems/ibc-rs/issues/316
[#560]: https://github.com/informalsystems/ibc-rs/issues/560
[#614]: https://github.com/informalsystems/ibc-rs/issues/614
[#624]: https://github.com/informalsystems/ibc-rs/issues/624
[#626]: https://github.com/informalsystems/ibc-rs/issues/626
[#643]: https://github.com/informalsystems/ibc-rs/issues/643

## v0.1.0
*February 4, 2021*
Expand Down
5 changes: 5 additions & 0 deletions modules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ optional = true
tokio = { version = "1.0", features = ["macros"] }
tendermint-rpc = { version = "=0.18.0", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "=0.18.0" } # Needed for generating (synthetic) light blocks.

[[test]]
name = "mbt"
path = "tests/mbt.rs"
required-features = ["mocks"]
2 changes: 1 addition & 1 deletion modules/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ These are currently generated manually, but can be easily mapped to Rust (see [s
The model-based tests can be run with the following command:

```bash
cargo test -p ibc --features mocks -- model_based
cargo test --features mocks -- mbt
```
25 changes: 4 additions & 21 deletions modules/tests/model_based.rs → modules/tests/executor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod modelator;
mod step;
pub mod modelator;
pub mod step;

use ibc::ics02_client::client_def::{AnyClientState, AnyConsensusState, AnyHeader};
use ibc::ics02_client::client_type::ClientType;
Expand All @@ -24,13 +24,13 @@ use step::{ActionOutcome, ActionType, Chain, Step};
use tendermint::account::Id as AccountId;

#[derive(Debug)]
struct IBCTestExecutor {
pub struct IBCTestExecutor {
// mapping from chain identifier to its context
contexts: HashMap<ChainId, MockContext>,
}

impl IBCTestExecutor {
fn new() -> Self {
pub fn new() -> Self {
Self {
contexts: Default::default(),
}
Expand Down Expand Up @@ -250,20 +250,3 @@ impl modelator::TestExecutor<Step> for IBCTestExecutor {
outcome_matches && self.check_chain_heights(step.chains)
}
}

const TESTS_DIR: &str = "tests/support/model_based/tests";

#[test]
fn model_based() {
let tests = vec!["ICS02UpdateOKTest", "ICS02HeaderVerificationFailureTest"];

for test in tests {
let test = format!("{}/{}.json", TESTS_DIR, test);
let executor = IBCTestExecutor::new();
// we should be able to just return the `Result` once the following issue
// is fixed: https://github.com/rust-lang/rust/issues/43301
if let Err(e) = modelator::test(&test, executor) {
panic!("{:?}", e);
}
}
}
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions modules/tests/mbt.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
mod executor;

const TESTS_DIR: &str = "tests/support/model_based/tests";

#[test]
fn mbt() {
let tests = vec!["ICS02UpdateOKTest", "ICS02HeaderVerificationFailureTest"];

for test in tests {
let test = format!("{}/{}.json", TESTS_DIR, test);
let executor = executor::IBCTestExecutor::new();
// we should be able to just return the `Result` once the following issue
// is fixed: https://github.com/rust-lang/rust/issues/43301
if let Err(e) = executor::modelator::test(&test, executor) {
panic!("{:?}", e);
}
}
}