Skip to content

Commit e876897

Browse files
committed
simulators/portal: refactor sims into 1 sim multi suite format
1 parent 30ef942 commit e876897

File tree

22 files changed

+187
-376
lines changed

22 files changed

+187
-376
lines changed

simulators/portal/beacon/rpc-compat/Dockerfile renamed to simulators/portal/beacon/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM rust:1.71.1 AS builder
1+
FROM rust:1.75.0 AS builder
22

33
# create a new empty shell project
4-
RUN USER=root cargo new --bin rpc-compat
5-
WORKDIR /rpc-compat
4+
RUN USER=root cargo new --bin beacon
5+
WORKDIR /beacon
66

77
RUN apt-get update && apt-get install clang -y
88

@@ -19,8 +19,8 @@ FROM ubuntu:22.04
1919
RUN apt update && apt install wget -y
2020

2121
# copy build artifacts from build stage
22-
COPY --from=builder /rpc-compat/target/release/rpc-compat .
22+
COPY --from=builder /beacon/target/release/beacon .
2323

2424
ENV RUST_LOG=debug
2525

26-
ENTRYPOINT ["./rpc-compat"]
26+
ENTRYPOINT ["./beacon"]

simulators/portal/beacon/rpc-compat/Cargo.toml

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
mod suites;
2+
3+
use hivesim::{Simulation, Suite, TestSpec};
4+
use suites::rpc_compat::run_rpc_compat_test_suite;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
tracing_subscriber::fmt::init();
9+
let mut beacon_rpc_compat = Suite {
10+
name: "beacon-rpc-compat".to_string(),
11+
description: "The RPC-compatibility test suite runs a set of RPC related tests against a
12+
running node. It tests client implementations of the JSON-RPC API for
13+
conformance with the portal network API specification."
14+
.to_string(),
15+
tests: vec![],
16+
};
17+
18+
beacon_rpc_compat.add(TestSpec {
19+
name: "client launch".to_string(),
20+
description: "This test launches the client and collects its logs.".to_string(),
21+
always_run: false,
22+
run: run_rpc_compat_test_suite,
23+
client: None,
24+
});
25+
26+
let sim = Simulation::new();
27+
run_suite(sim, vec![beacon_rpc_compat]).await;
28+
}
29+
30+
async fn run_suite(host: Simulation, suites: Vec<Suite>) {
31+
for suite in suites {
32+
let name = suite.clone().name;
33+
let description = suite.clone().description;
34+
35+
let suite_id = host.start_suite(name, description, "".to_string()).await;
36+
37+
for test in &suite.tests {
38+
test.run_test(host.clone(), suite_id, suite.clone()).await;
39+
}
40+
41+
host.end_suite(suite_id).await;
42+
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
pub const HIVE_PORTAL_NETWORKS_SELECTED: &str = "HIVE_PORTAL_NETWORKS_SELECTED";
22
pub const BEACON_STRING: &str = "beacon";
3+
4+
// trin-bridge constants
5+
pub const TRIN_BRIDGE_CLIENT_TYPE: &str = "trin-bridge";
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod constants;
2+
pub mod rpc_compat;

simulators/portal/beacon/rpc-compat/src/main.rs renamed to simulators/portal/beacon/src/suites/rpc_compat.rs

Lines changed: 8 additions & 43 deletions
Large diffs are not rendered by default.

simulators/portal/history/portal-interop/Dockerfile renamed to simulators/portal/history/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM rust:1.71.1 AS builder
1+
FROM rust:1.75.0 AS builder
22

33
# create a new empty shell project
4-
RUN USER=root cargo new --bin portal-interop
5-
WORKDIR /portal-interop
4+
RUN USER=root cargo new --bin history
5+
WORKDIR /history
66

77
# copy over manifests and source to build image
88
COPY Cargo.toml ./Cargo.toml
@@ -17,9 +17,9 @@ FROM ubuntu:22.04
1717
RUN apt update && apt install wget -y
1818

1919
# copy build artifacts from build stage
20-
COPY --from=builder /portal-interop/target/release/portal-interop .
20+
COPY --from=builder /history/target/release/history .
2121
ADD https://raw.githubusercontent.com/ethereum/portal-spec-tests/master/tests/mainnet/history/hive/test_data_collection_of_forks_blocks.yaml ./test-data/test_data_collection_of_forks_blocks.yaml
2222

2323
ENV RUST_LOG=debug
2424

25-
ENTRYPOINT ["./portal-interop"]
25+
ENTRYPOINT ["./history"]

simulators/portal/history/portal-interop/Cargo.toml

Lines changed: 0 additions & 16 deletions
This file was deleted.

simulators/portal/history/portal-interop/src/constants.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

simulators/portal/history/portal-mesh/Cargo.toml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)