Refactor monero-harness containers

1. Split up image::Monero into Monerod and MoneroWalletRpc
2. Don't use `bash` to run the internal command. Instead we disable
the entrypoint script as per https://github.com/XMRto/monero#raw-commands
3. Remove the start up delay by listening for the correct log message.
To make this more resilient, we make the log level NOT configurable and
instead always log verbosely.
This commit is contained in:
Thomas Eizinger 2021-04-19 17:26:11 +10:00
parent 64729ffecc
commit 8d76607343
No known key found for this signature in database
GPG key ID: 651AC83A6C6C8B96
9 changed files with 161 additions and 205 deletions

View file

@ -4,8 +4,6 @@ use harness::SlowCancelConfig;
use swap::protocol::{alice, bob};
use tokio::join;
/// Run the following tests with RUST_MIN_STACK=10000000
#[tokio::test]
async fn happy_path() {
harness::setup_test(SlowCancelConfig, |mut ctx| async move {

View file

@ -150,11 +150,16 @@ async fn init_containers(cli: &Cli) -> (Monero, Containers<'_>) {
let electrs = init_electrs_container(&cli, prefix.clone(), bitcoind_name, prefix)
.await
.expect("could not init electrs");
let (monero, monerods) = init_monero_container(&cli).await;
let (monero, monerod_container, monero_wallet_rpc_containers) =
Monero::new(&cli, vec![MONERO_WALLET_NAME_ALICE, MONERO_WALLET_NAME_BOB])
.await
.unwrap();
(monero, Containers {
bitcoind_url,
bitcoind,
monerods,
monerod_container,
monero_wallet_rpc_containers,
electrs,
})
}
@ -189,20 +194,6 @@ async fn init_bitcoind_container(
Ok((docker, bitcoind_url.clone()))
}
async fn init_monero_container(
cli: &Cli,
) -> (
Monero,
Vec<Container<'_, Cli, monero_harness::image::Monero>>,
) {
let (monero, monerods) =
Monero::new(&cli, vec![MONERO_WALLET_NAME_ALICE, MONERO_WALLET_NAME_BOB])
.await
.unwrap();
(monero, monerods)
}
pub async fn init_electrs_container(
cli: &Cli,
volume: String,
@ -892,7 +883,8 @@ pub async fn mint(node_url: Url, address: bitcoin::Address, amount: bitcoin::Amo
struct Containers<'a> {
bitcoind_url: Url,
bitcoind: Container<'a, Cli, bitcoind::Bitcoind>,
monerods: Vec<Container<'a, Cli, image::Monero>>,
monerod_container: Container<'a, Cli, image::Monerod>,
monero_wallet_rpc_containers: Vec<Container<'a, Cli, image::MoneroWalletRpc>>,
electrs: Container<'a, Cli, electrs::Electrs>,
}