Skip to content

Commit

Permalink
Merge pull request fedimint#6518 from joschisan/lnv2_tests_fix
Browse files Browse the repository at this point in the history
fix: check that full balance becomes available to the client
  • Loading branch information
elsirion authored Dec 10, 2024
2 parents b1154e5 + 134d199 commit 37965cf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
6 changes: 5 additions & 1 deletion modules/fedimint-lnv2-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ name = "fedimint-lnv2-tests"
version = { workspace = true }
authors = ["The Fedimint Developers"]
edition = "2021"
description = "fedimint-ln-tests contains integration tests for the lightning module"
description = "fedimint-lnv2-tests contains integration tests for the lnv2 module"
license = "MIT"
publish = false

[[bin]]
name = "fedimint-lnv2-devimint-tests"
path = "bin/tests.rs"

[[test]]
name = "fedimint_lnv2_tests"
path = "tests/tests.rs"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use anyhow::ensure;
use devimint::devfed::DevJitFed;
use devimint::federation::Client;
use devimint::version_constants::VERSION_0_5_0_ALPHA;
use devimint::{cmd, util};
use fedimint_core::core::OperationId;
use fedimint_core::util::{backoff_util, retry};
use fedimint_lnv2_client::{FinalReceiveOperationState, FinalSendOperationState};
use lightning_invoice::Bolt11Invoice;
use substring::Substring;
Expand Down Expand Up @@ -157,6 +159,8 @@ async fn test_payments(dev_fed: &DevJitFed) -> anyhow::Result<()> {

federation.pegin_client(10_000, &client).await?;

assert_eq!(client.balance().await?, 10_000 * 1000);

let gw_lnd = dev_fed.gw_lnd().await?;
let gw_ldk = dev_fed
.gw_ldk()
Expand Down Expand Up @@ -260,7 +264,18 @@ async fn test_payments(dev_fed: &DevJitFed) -> anyhow::Result<()> {
await_receive_claimed(&client, receive_op).await?;
}

info!("Testing LDK Gateway can pay HOLD invoice...");
retry(
"Waiting for the full balance to become available to the client".to_string(),
backoff_util::background_backoff(),
|| async {
ensure!(client.balance().await? >= 9000 * 1000);

Ok(())
},
)
.await?;

info!("Testing Client can pay LND HOLD invoice via LDK Gateway...");

try_join!(
test_send(
Expand Down
3 changes: 1 addition & 2 deletions scripts/tests/lnv2-module-test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
# Runs a test to determine the latency of certain user actions

set -euo pipefail
export RUST_LOG="${RUST_LOG:-info}"
Expand All @@ -8,4 +7,4 @@ source scripts/_common.sh
build_workspace
add_target_dir_to_path

tests all
fedimint-lnv2-devimint-tests

0 comments on commit 37965cf

Please sign in to comment.