-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simulators/portal: refactor sims into 1 sim multi suite format
- Loading branch information
Showing
22 changed files
with
187 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
mod suites; | ||
|
||
use hivesim::{Simulation, Suite, TestSpec}; | ||
use suites::rpc_compat::run_rpc_compat_test_suite; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
tracing_subscriber::fmt::init(); | ||
let mut beacon_rpc_compat = Suite { | ||
name: "beacon-rpc-compat".to_string(), | ||
description: "The RPC-compatibility test suite runs a set of RPC related tests against a | ||
running node. It tests client implementations of the JSON-RPC API for | ||
conformance with the portal network API specification." | ||
.to_string(), | ||
tests: vec![], | ||
}; | ||
|
||
beacon_rpc_compat.add(TestSpec { | ||
name: "client launch".to_string(), | ||
description: "This test launches the client and collects its logs.".to_string(), | ||
always_run: false, | ||
run: run_rpc_compat_test_suite, | ||
client: None, | ||
}); | ||
|
||
let sim = Simulation::new(); | ||
run_suite(sim, vec![beacon_rpc_compat]).await; | ||
} | ||
|
||
async fn run_suite(host: Simulation, suites: Vec<Suite>) { | ||
for suite in suites { | ||
let name = suite.clone().name; | ||
let description = suite.clone().description; | ||
|
||
let suite_id = host.start_suite(name, description, "".to_string()).await; | ||
|
||
for test in &suite.tests { | ||
test.run_test(host.clone(), suite_id, suite.clone()).await; | ||
} | ||
|
||
host.end_suite(suite_id).await; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...portal/beacon/rpc-compat/src/constants.rs → ...ors/portal/beacon/src/suites/constants.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
pub const HIVE_PORTAL_NETWORKS_SELECTED: &str = "HIVE_PORTAL_NETWORKS_SELECTED"; | ||
pub const BEACON_STRING: &str = "beacon"; | ||
|
||
// trin-bridge constants | ||
pub const TRIN_BRIDGE_CLIENT_TYPE: &str = "trin-bridge"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod constants; | ||
pub mod rpc_compat; |
51 changes: 8 additions & 43 deletions
51
...tors/portal/beacon/rpc-compat/src/main.rs → ...rs/portal/beacon/src/suites/rpc_compat.rs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
pub mod suites; | ||
|
||
use hivesim::{Simulation, Suite, TestSpec}; | ||
use suites::interop::test_portal_interop; | ||
use suites::mesh::test_portal_scenarios; | ||
use suites::rpc_compat::run_rpc_compat_test_suite; | ||
use suites::trin_bridge::test_portal_bridge; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
tracing_subscriber::fmt::init(); | ||
let mut rpc_compat = Suite { | ||
name: "history-rpc-compat".to_string(), | ||
description: "The RPC-compatibility test suite runs a set of RPC related tests against a | ||
running node. It tests client implementations of the JSON-RPC API for | ||
conformance with the portal network API specification." | ||
.to_string(), | ||
tests: vec![], | ||
}; | ||
|
||
rpc_compat.add(TestSpec { | ||
name: "client launch".to_string(), | ||
description: "This test launches the client and collects its logs.".to_string(), | ||
always_run: false, | ||
run: run_rpc_compat_test_suite, | ||
client: None, | ||
}); | ||
|
||
let mut interop = Suite { | ||
name: "history-interop".to_string(), | ||
description: | ||
"The interop test suite runs a set of scenarios to test interoperability between | ||
portal network clients" | ||
.to_string(), | ||
tests: vec![], | ||
}; | ||
|
||
interop.add(TestSpec { | ||
name: "client launch".to_string(), | ||
description: "This test launches the client and collects its logs.".to_string(), | ||
always_run: false, | ||
run: test_portal_interop, | ||
client: None, | ||
}); | ||
|
||
let mut mesh = Suite { | ||
name: "history-mesh".to_string(), | ||
description: "The portal mesh test suite runs a set of scenarios to test 3 clients" | ||
.to_string(), | ||
tests: vec![], | ||
}; | ||
|
||
mesh.add(TestSpec { | ||
name: "client launch".to_string(), | ||
description: "This test launches the client and collects its logs.".to_string(), | ||
always_run: false, | ||
run: test_portal_scenarios, | ||
client: None, | ||
}); | ||
|
||
let mut trin_bridge = Suite { | ||
name: "history-trin-bridge".to_string(), | ||
description: "The portal bridge test suite".to_string(), | ||
tests: vec![], | ||
}; | ||
|
||
trin_bridge.add(TestSpec { | ||
name: "client launch".to_string(), | ||
description: "This test launches the client and collects its logs.".to_string(), | ||
always_run: false, | ||
run: test_portal_bridge, | ||
client: None, | ||
}); | ||
|
||
let sim = Simulation::new(); | ||
run_suite(sim, vec![rpc_compat, interop, mesh, trin_bridge]).await; | ||
} | ||
|
||
async fn run_suite(host: Simulation, suites: Vec<Suite>) { | ||
for suite in suites { | ||
let name = suite.clone().name; | ||
let description = suite.clone().description; | ||
|
||
let suite_id = host.start_suite(name, description, "".to_string()).await; | ||
|
||
for test in &suite.tests { | ||
test.run_test(host.clone(), suite_id, suite.clone()).await; | ||
} | ||
|
||
host.end_suite(suite_id).await; | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
...rtal/history/trin-bridge/src/constants.rs → ...rs/portal/history/src/suites/constants.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
pub const TEST_DATA_FILE_PATH: &str = "./test-data/test_data_collection_of_forks_blocks.yaml"; | ||
|
||
// trin-bridge constants | ||
pub const TRIN_BRIDGE_CLIENT_TYPE: &str = "trin-bridge"; | ||
pub const BOOTNODES_ENVIRONMENT_VARIABLE: &str = "HIVE_BOOTNODES"; | ||
pub const HIVE_CHECK_LIVE_PORT: &str = "HIVE_CHECK_LIVE_PORT"; | ||
pub const TEST_DATA_FILE_PATH: &str = "./test-data/test_data_collection_of_forks_blocks.yaml"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.