mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +00:00
Simultaenously build Docker images used in tests
This commit is contained in:
@@ -35,6 +35,7 @@ serai-client = { path = "../../substrate/client", features = ["serai"] }
|
||||
tokio = { version = "1", features = ["time"] }
|
||||
|
||||
dockertest = "0.4"
|
||||
serai-docker-tests = { path = "../docker" }
|
||||
serai-message-queue-tests = { path = "../message-queue" }
|
||||
serai-processor-tests = { path = "../processor" }
|
||||
serai-coordinator-tests = { path = "../coordinator" }
|
||||
|
||||
@@ -31,19 +31,30 @@ pub struct Handles {
|
||||
serai: String,
|
||||
}
|
||||
|
||||
pub fn full_stack(name: &str) -> (Handles, Vec<TestBodySpecification>) {
|
||||
let (coord_key, message_queue_keys, message_queue_composition) = message_queue_instance();
|
||||
pub async fn full_stack(name: &str) -> (Handles, Vec<TestBodySpecification>) {
|
||||
let mut docker_names = serai_processor_tests::docker_names(NetworkId::Bitcoin);
|
||||
docker_names.append(&mut serai_processor_tests::docker_names(NetworkId::Monero));
|
||||
docker_names.extend([
|
||||
serai_message_queue_tests::docker_name(),
|
||||
serai_coordinator_tests::serai_docker_name(),
|
||||
serai_coordinator_tests::coordinator_docker_name(),
|
||||
]);
|
||||
serai_docker_tests::build_batch(docker_names).await;
|
||||
|
||||
let (bitcoin_composition, bitcoin_port) = network_instance(NetworkId::Bitcoin);
|
||||
let (coord_key, message_queue_keys, message_queue_composition) = message_queue_instance().await;
|
||||
|
||||
let (bitcoin_composition, bitcoin_port) = network_instance(NetworkId::Bitcoin).await;
|
||||
let bitcoin_processor_composition =
|
||||
processor_instance(NetworkId::Bitcoin, bitcoin_port, message_queue_keys[&NetworkId::Bitcoin]);
|
||||
processor_instance(NetworkId::Bitcoin, bitcoin_port, message_queue_keys[&NetworkId::Bitcoin])
|
||||
.await;
|
||||
|
||||
let (monero_composition, monero_port) = network_instance(NetworkId::Monero);
|
||||
let (monero_composition, monero_port) = network_instance(NetworkId::Monero).await;
|
||||
let monero_processor_composition =
|
||||
processor_instance(NetworkId::Monero, monero_port, message_queue_keys[&NetworkId::Monero]);
|
||||
processor_instance(NetworkId::Monero, monero_port, message_queue_keys[&NetworkId::Monero])
|
||||
.await;
|
||||
|
||||
let coordinator_composition = coordinator_instance(name, coord_key);
|
||||
let serai_composition = serai_composition(name);
|
||||
let coordinator_composition = coordinator_instance(name, coord_key).await;
|
||||
let serai_composition = serai_composition(name).await;
|
||||
|
||||
// Give every item in this stack a unique ID
|
||||
// Uses a Mutex as we can't generate a 8-byte random ID without hitting hostname length limits
|
||||
|
||||
@@ -26,7 +26,7 @@ use crate::tests::*;
|
||||
#[tokio::test]
|
||||
async fn mint_and_burn_test() {
|
||||
let _one_at_a_time = ONE_AT_A_TIME.get_or_init(|| Mutex::new(())).lock();
|
||||
let (handles, test) = new_test();
|
||||
let (handles, test) = new_test().await;
|
||||
|
||||
test
|
||||
.run_async(|ops| async move {
|
||||
|
||||
@@ -11,7 +11,7 @@ pub(crate) const VALIDATORS: usize = 4;
|
||||
|
||||
pub(crate) static ONE_AT_A_TIME: OnceLock<Mutex<()>> = OnceLock::new();
|
||||
|
||||
pub(crate) fn new_test() -> (Vec<Handles>, DockerTest) {
|
||||
pub(crate) async fn new_test() -> (Vec<Handles>, DockerTest) {
|
||||
let mut validators = vec![];
|
||||
let mut test = DockerTest::new().with_network(dockertest::Network::Isolated);
|
||||
for i in 0 .. VALIDATORS {
|
||||
@@ -23,7 +23,8 @@ pub(crate) fn new_test() -> (Vec<Handles>, DockerTest) {
|
||||
4 => "Eve",
|
||||
5 => "Ferdie",
|
||||
_ => panic!("needed a 7th name for a serai node"),
|
||||
});
|
||||
})
|
||||
.await;
|
||||
validators.push(handles);
|
||||
for composition in compositions {
|
||||
test.provide_container(composition);
|
||||
|
||||
Reference in New Issue
Block a user