Skip to content

Commit bb6b7a5

Browse files
authored
Split out test framework from integration tests (informalsystems#1961)
* Split out test framework from integration tests * Fix integration test not triggering * Add changelog * Fix doc tests
1 parent 2ad255a commit bb6b7a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+171
-135
lines changed
Lines changed: 1 addition & 0 deletions

Cargo.lock

Lines changed: 33 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ members = [
1010
"telemetry",
1111
"proto",
1212
"tools/integration-test",
13+
"tools/test-framework",
1314
]
1415

1516
exclude = [

tools/integration-test/Cargo.toml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,11 @@ ibc = { path = "../../modules" }
1818
ibc-relayer = { path = "../../relayer" }
1919
ibc-relayer-cli = { path = "../../relayer-cli" }
2020
ibc-proto = { path = "../../proto" }
21+
ibc-test-framework = { path = "../test-framework" }
2122
tendermint = { version = "=0.23.5" }
2223
tendermint-rpc = { version = "=0.23.5", features = ["http-client", "websocket-client"] }
2324

24-
tokio = { version = "1.0", features = ["full"] }
25-
tracing = "0.1.32"
26-
tracing-subscriber = "0.3.9"
27-
eyre = "0.6.7"
28-
color-eyre = "0.6"
29-
rand = "0.8.5"
30-
env_logger = "0.9.0"
31-
hex = "0.4.3"
32-
serde = "1.0"
3325
serde_json = "1"
34-
serde_yaml = "0.8.23"
35-
itertools = "0.10"
36-
toml = "0.5"
37-
subtle-encoding = "0.5.1"
38-
sha2 = "0.10.2"
39-
crossbeam-channel = "0.5.2"
40-
prost = { version = "0.9", default-features = false }
41-
prost-types = { version = "0.9", default-features = false }
42-
semver = "1.0.6"
43-
flex-error = "0.4.4"
4426

4527
[features]
4628
default = []

tools/integration-test/src/bin/test_setup_with_binary_channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
```
2626
*/
2727

28-
use ibc_integration_test::prelude::*;
2928
use ibc_relayer::keyring::Store;
29+
use ibc_test_framework::prelude::*;
3030

3131
struct Test;
3232

tools/integration-test/src/lib.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,2 @@
1-
// #![deny(warnings)]
2-
#![allow(clippy::too_many_arguments)]
3-
#![allow(clippy::type_complexity)]
4-
#![allow(clippy::ptr_arg)]
5-
#![doc = include_str!("../README.md")]
6-
7-
extern crate alloc;
8-
9-
pub mod bootstrap;
10-
pub mod chain;
11-
pub mod error;
12-
pub mod framework;
13-
pub mod ibc;
14-
pub mod prelude;
15-
pub mod relayer;
16-
pub mod types;
17-
pub mod util;
18-
19-
#[cfg(any(test, doc))]
20-
#[macro_use]
1+
#[cfg(test)]
212
pub mod tests;

tools/integration-test/src/tests/clear_packet.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::ibc::denom::derive_ibc_denom;
2-
use crate::prelude::*;
3-
use crate::util::random::random_u64_range;
1+
use ibc_test_framework::ibc::denom::derive_ibc_denom;
2+
use ibc_test_framework::prelude::*;
3+
use ibc_test_framework::util::random::random_u64_range;
44

55
#[test]
66
fn test_clear_packet() -> Result<(), Error> {

tools/integration-test/src/tests/client_expiration.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ use ibc_relayer::config::default::connection_delay as default_connection_delay;
55
use ibc_relayer::config::{self, Config, ModeConfig};
66
use std::thread::sleep;
77

8-
use crate::bootstrap::binary::chain::bootstrap_foreign_client_pair;
9-
use crate::bootstrap::binary::channel::{
8+
use ibc_test_framework::bootstrap::binary::chain::bootstrap_foreign_client_pair;
9+
use ibc_test_framework::bootstrap::binary::channel::{
1010
bootstrap_channel_with_chains, bootstrap_channel_with_connection,
1111
};
12-
use crate::bootstrap::binary::connection::bootstrap_connection;
13-
use crate::ibc::denom::derive_ibc_denom;
14-
use crate::prelude::*;
15-
use crate::relayer::channel::{
12+
use ibc_test_framework::bootstrap::binary::connection::bootstrap_connection;
13+
use ibc_test_framework::ibc::denom::derive_ibc_denom;
14+
use ibc_test_framework::prelude::*;
15+
use ibc_test_framework::relayer::channel::{
1616
assert_eventually_channel_established, init_channel, query_channel_end,
1717
};
18-
use crate::relayer::connection::{
18+
use ibc_test_framework::relayer::connection::{
1919
assert_eventually_connection_established, init_connection, query_connection_end,
2020
};
21-
use crate::relayer::refresh::spawn_refresh_client_tasks;
21+
use ibc_test_framework::relayer::refresh::spawn_refresh_client_tasks;
2222

2323
// The cosmos ChainHandle handles requests in serial, and a refresh client
2424
// request may get blocked by other operations and cause the refresh to fail

tools/integration-test/src/tests/example.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
2929
We first define an empty struct [`ExampleTest`] to represent our test case.
3030
We then implement the
31-
[`BinaryChannelTest`](crate::framework::binary::channel::BinaryChannelTest)
31+
[`BinaryChannelTest`](ibc_test_framework::framework::binary::channel::BinaryChannelTest)
3232
trait so that the test framework sets up the relayer with two chains
3333
running together with connected channels.
3434
@@ -44,12 +44,12 @@
4444
4545
Finally, we define the `example_test` function with the `#[test]` pragma
4646
as the entry point for Rust to execute the test. We call the runner function
47-
[`run_binary_channel_test`](crate::framework::binary::channel::run_binary_channel_test),
47+
[`run_binary_channel_test`](ibc_test_framework::framework::binary::channel::run_binary_channel_test),
4848
which accepts a reference to any struct implementing
49-
[`BinaryChannelTest`](crate::framework::binary::channel::BinaryChannelTest)
49+
[`BinaryChannelTest`](ibc_test_framework::framework::binary::channel::BinaryChannelTest)
5050
and run the test for us.
5151
52-
By convention, the tests written are placed in the [`tests`](crate::tests)
52+
By convention, the tests written are placed in the [`tests`](ibc_test_framework::tests)
5353
module. We can then run the test on the command line such as follows:
5454
5555
```bash
@@ -62,7 +62,7 @@
6262
and `RUST_BACKTRACE` to display backtrace when errors occurred.
6363
The test flag `--test-threads=1` is set so that Rust do not run multiple
6464
tests in parallel, as it can make it difficult to follow the logs.
65-
See [TestConfig](crate::types::config::TestConfig) for more information
65+
See [TestConfig](ibc_test_framework::types::config::TestConfig) for more information
6666
about configuring how the tests should be run.
6767
6868
For this example, we disable the test from running by default, since
@@ -112,7 +112,7 @@
112112
same directory.
113113
*/
114114

115-
use crate::prelude::*;
115+
use ibc_test_framework::prelude::*;
116116

117117
#[test]
118118
pub fn example_test() -> Result<(), Error> {

tools/integration-test/src/tests/manual/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
are only enabled when the `"manual"` feature flag is enabled manually.
88
99
Any tests that require manual verification should be placed here.
10-
It is also fine to use [`suspend`](crate::util::suspend::suspend)
10+
It is also fine to use [`suspend`](ibc_test_framework::util::suspend::suspend)
1111
inside the manual test, as the CI is not going to run the test.
1212
*/
1313

0 commit comments

Comments
 (0)