mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
dockertest 0.4 (#406)
* Updates to modern dockertest * More updates to latest dockertest * Update Cargo.lock to dockertest with handle restored * clippy coordinator tests * clippy full-stack tests * Remove kayabaNerve branch for official repo's latest commit hash * Update serai-client, remove reliance on the existence of a handle fn * Don't use the hex encoding of unique_id in dockertests Gets our hostnames just below 64 bytes, resolving test failures on at least Debian-based systems. * Use Network::Isolated for all dockertest instances * Correct error from prior commit's edits
This commit is contained in:
@@ -43,7 +43,7 @@ schnorrkel = { path = "../../crypto/schnorrkel", package = "frost-schnorrkel" }
|
||||
|
||||
tokio = "1"
|
||||
|
||||
dockertest = "0.3"
|
||||
dockertest = "0.4"
|
||||
serai-docker-tests = { path = "../../tests/docker" }
|
||||
|
||||
[features]
|
||||
|
||||
@@ -9,37 +9,38 @@ macro_rules! serai_test {
|
||||
#[tokio::test]
|
||||
async fn $name() {
|
||||
use dockertest::{
|
||||
PullPolicy, StartPolicy, LogOptions, LogAction, LogPolicy, LogSource, Image, Composition,
|
||||
DockerTest,
|
||||
PullPolicy, StartPolicy, LogOptions, LogAction, LogPolicy, LogSource, Image,
|
||||
TestBodySpecification, DockerTest,
|
||||
};
|
||||
|
||||
serai_docker_tests::build("serai".to_string());
|
||||
|
||||
let mut composition = Composition::with_image(
|
||||
let handle = concat!("serai_client-serai_node-", stringify!($name));
|
||||
|
||||
let composition = TestBodySpecification::with_image(
|
||||
Image::with_repository("serai-dev-serai").pull_policy(PullPolicy::Never),
|
||||
)
|
||||
.with_cmd(vec![
|
||||
.replace_cmd(vec![
|
||||
"serai-node".to_string(),
|
||||
"--dev".to_string(),
|
||||
"--unsafe-rpc-external".to_string(),
|
||||
"--rpc-cors".to_string(),
|
||||
"all".to_string(),
|
||||
])
|
||||
.with_start_policy(StartPolicy::Strict)
|
||||
.with_log_options(Some(LogOptions {
|
||||
.set_publish_all_ports(true)
|
||||
.set_handle(handle)
|
||||
.set_start_policy(StartPolicy::Strict)
|
||||
.set_log_options(Some(LogOptions {
|
||||
action: LogAction::Forward,
|
||||
policy: LogPolicy::Always,
|
||||
source: LogSource::Both,
|
||||
}));
|
||||
composition.publish_all_ports();
|
||||
|
||||
let handle = composition.handle();
|
||||
|
||||
let mut test = DockerTest::new();
|
||||
test.add_composition(composition);
|
||||
let mut test = DockerTest::new().with_network(dockertest::Network::Isolated);
|
||||
test.provide_container(composition);
|
||||
test.run_async(|ops| async move {
|
||||
// Sleep until the Substrate RPC starts
|
||||
let serai_rpc = ops.handle(&handle).host_port(9944).unwrap();
|
||||
let serai_rpc = ops.handle(handle).host_port(9944).unwrap();
|
||||
let serai_rpc = format!("ws://{}:{}", serai_rpc.0, serai_rpc.1);
|
||||
// Bound execution to 60 seconds
|
||||
for _ in 0 .. 60 {
|
||||
|
||||
Reference in New Issue
Block a user