mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-01-11 07:29:39 -05:00
Upgrade to testcontainers v0.12
This commit is contained in:
parent
7a9569ffd4
commit
8c83f7e2e1
41
Cargo.lock
generated
41
Cargo.lock
generated
@ -321,7 +321,7 @@ dependencies = [
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"testcontainers",
|
||||
"testcontainers 0.11.0",
|
||||
"thiserror",
|
||||
"tokio 1.0.2",
|
||||
"tracing",
|
||||
@ -726,6 +726,16 @@ dependencies = [
|
||||
"subtle 2.4.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-mac"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6"
|
||||
dependencies = [
|
||||
"generic-array 0.14.4",
|
||||
"subtle 2.4.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "csv"
|
||||
version = "1.1.5"
|
||||
@ -1382,6 +1392,16 @@ dependencies = [
|
||||
"digest 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hmac"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15"
|
||||
dependencies = [
|
||||
"crypto-mac 0.10.0",
|
||||
"digest 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hmac-drbg"
|
||||
version = "0.2.0"
|
||||
@ -2008,7 +2028,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"spectral",
|
||||
"testcontainers",
|
||||
"testcontainers 0.12.0",
|
||||
"tokio 1.0.2",
|
||||
"tracing",
|
||||
"tracing-log",
|
||||
@ -3513,7 +3533,7 @@ dependencies = [
|
||||
"structopt",
|
||||
"strum",
|
||||
"tempfile",
|
||||
"testcontainers",
|
||||
"testcontainers 0.12.0",
|
||||
"thiserror",
|
||||
"time",
|
||||
"tokio 1.0.2",
|
||||
@ -3602,6 +3622,21 @@ dependencies = [
|
||||
"sha2 0.9.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "testcontainers"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d5e3ed6e3598dbf32cba8cb356b881c085e0adea57597f387723430dd94b4084"
|
||||
dependencies = [
|
||||
"hex 0.4.2",
|
||||
"hmac 0.10.1",
|
||||
"log",
|
||||
"rand 0.8.2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.9.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
|
@ -14,7 +14,7 @@ reqwest = { version = "0.11", default-features = false, features = ["json", "nat
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
spectral = "0.6"
|
||||
testcontainers = "0.11"
|
||||
testcontainers = "0.12"
|
||||
tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "time", "macros"] }
|
||||
tracing = "0.1"
|
||||
tracing-log = "0.1"
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::{collections::HashMap, env::var, thread::sleep, time::Duration};
|
||||
use testcontainers::{
|
||||
core::{Container, Docker, Port, WaitForMessage},
|
||||
core::{Container, Docker, WaitForMessage},
|
||||
Image,
|
||||
};
|
||||
|
||||
@ -13,7 +13,6 @@ pub const WALLET_RPC_PORT: u16 = 48083;
|
||||
pub struct Monero {
|
||||
tag: String,
|
||||
args: Args,
|
||||
ports: Option<Vec<Port>>,
|
||||
entrypoint: Option<String>,
|
||||
wait_for_message: String,
|
||||
}
|
||||
@ -57,10 +56,6 @@ impl Image for Monero {
|
||||
HashMap::new()
|
||||
}
|
||||
|
||||
fn ports(&self) -> Option<Vec<Port>> {
|
||||
self.ports.clone()
|
||||
}
|
||||
|
||||
fn with_args(self, args: <Self as Image>::Args) -> Self {
|
||||
Monero { args, ..self }
|
||||
}
|
||||
@ -82,7 +77,6 @@ impl Default for Monero {
|
||||
Monero {
|
||||
tag: "v0.16.0.3".into(),
|
||||
args: Args::default(),
|
||||
ports: None,
|
||||
entrypoint: Some("".into()),
|
||||
wait_for_message: "core RPC server started ok".to_string(),
|
||||
}
|
||||
@ -97,13 +91,6 @@ impl Monero {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_mapped_port<P: Into<Port>>(mut self, port: P) -> Self {
|
||||
let mut ports = self.ports.unwrap_or_default();
|
||||
ports.push(port.into());
|
||||
self.ports = Some(ports);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn wallet(name: &str, daemon_address: String) -> Self {
|
||||
let wallet = WalletArgs::new(name, daemon_address, WALLET_RPC_PORT);
|
||||
let default = Monero::default();
|
||||
|
@ -183,13 +183,14 @@ impl<'c> Monerod {
|
||||
let monerod_rpc_port: u16 =
|
||||
port_check::free_local_port().ok_or_else(|| anyhow!("Could not retrieve free port"))?;
|
||||
|
||||
let image = image::Monero::default().with_mapped_port(Port {
|
||||
let image = image::Monero::default();
|
||||
let run_args = RunArgs::default()
|
||||
.with_name(name.clone())
|
||||
.with_network(network.clone())
|
||||
.with_mapped_port(Port {
|
||||
local: monerod_rpc_port,
|
||||
internal: MONEROD_RPC_PORT,
|
||||
});
|
||||
let run_args = RunArgs::default()
|
||||
.with_name(name.clone())
|
||||
.with_network(network.clone());
|
||||
let docker = cli.run_with_args(image, run_args);
|
||||
|
||||
Ok((
|
||||
@ -227,15 +228,16 @@ impl<'c> MoneroWalletRpc {
|
||||
port_check::free_local_port().ok_or_else(|| anyhow!("Could not retrieve free port"))?;
|
||||
|
||||
let daemon_address = format!("{}:{}", monerod.name, MONEROD_RPC_PORT);
|
||||
let image = image::Monero::wallet(&name, daemon_address).with_mapped_port(Port {
|
||||
local: wallet_rpc_port,
|
||||
internal: WALLET_RPC_PORT,
|
||||
});
|
||||
let image = image::Monero::wallet(&name, daemon_address);
|
||||
|
||||
let network = monerod.network.clone();
|
||||
let run_args = RunArgs::default()
|
||||
.with_name(name)
|
||||
.with_network(network.clone());
|
||||
.with_network(network.clone())
|
||||
.with_mapped_port(Port {
|
||||
local: wallet_rpc_port,
|
||||
internal: WALLET_RPC_PORT,
|
||||
});
|
||||
let docker = cli.run_with_args(image, run_args);
|
||||
|
||||
// create new wallet
|
||||
|
@ -71,4 +71,4 @@ port_check = "0.1"
|
||||
serde_cbor = "0.11"
|
||||
spectral = "0.6"
|
||||
tempfile = "3"
|
||||
testcontainers = "0.11"
|
||||
testcontainers = "0.12"
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
use testcontainers::{
|
||||
core::{Container, Docker, Port, WaitForMessage},
|
||||
core::{Container, Docker, WaitForMessage},
|
||||
Image,
|
||||
};
|
||||
|
||||
@ -55,10 +55,6 @@ impl Image for Bitcoind {
|
||||
HashMap::new()
|
||||
}
|
||||
|
||||
fn ports(&self) -> Option<Vec<Port>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn with_args(self, args: <Self as Image>::Args) -> Self {
|
||||
Bitcoind { args, ..self }
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ use crate::testutils::bitcoind;
|
||||
use bitcoin::Network;
|
||||
use std::collections::HashMap;
|
||||
use testcontainers::{
|
||||
core::{Container, Docker, Port, WaitForMessage},
|
||||
core::{Container, Docker, WaitForMessage},
|
||||
Image,
|
||||
};
|
||||
|
||||
@ -51,10 +51,6 @@ impl Image for Electrs {
|
||||
HashMap::new()
|
||||
}
|
||||
|
||||
fn ports(&self) -> Option<Vec<Port>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn with_args(self, args: <Self as Image>::Args) -> Self {
|
||||
Electrs { args, ..self }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user