You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wow-btc-swap/monero-harness/tests/monerod.rs

52 lines
1.3 KiB

use monero_harness::Monero;
use spectral::prelude::*;
4 years ago
use std::time::Duration;
use testcontainers::clients::Cli;
4 years ago
use tokio::time;
#[tokio::test]
4 years ago
async fn init_miner_and_mine_to_miner_address() {
let tc = Cli::default();
let (monerod, _monerod_container) = Monero::new_monerod(&tc).unwrap();
let (miner_wallet, _wallet_container) = Monero::new_wallet(&tc, "miner").await.unwrap();
let address = miner_wallet
.wallet_rpc_client()
.get_address(0)
.await
.unwrap()
.address;
monerod.start_miner(&address).await.unwrap();
let block_height = monerod
.monerod_rpc_client()
.get_block_count()
.await
.unwrap();
miner_wallet
.wait_for_wallet_height(block_height)
.await
.unwrap();
let got_miner_balance = miner_wallet
.wallet_rpc_client()
.get_balance(0)
.await
.unwrap();
assert_that!(got_miner_balance).is_greater_than(0);
time::delay_for(Duration::from_millis(1010)).await;
4 years ago
// after a bit more than 1 sec another block should have been mined
let block_height = monerod
.monerod_rpc_client()
.get_block_count()
.await
4 years ago
.unwrap();
4 years ago
assert_that(&block_height).is_greater_than(70);
}