From b5b8ee557c1af4bdb6341d21714b77754746a9bf Mon Sep 17 00:00:00 2001 From: C Date: Mon, 8 Sep 2025 09:02:45 -0300 Subject: [PATCH] Fix race conditions in minting tests (#1043) There was a race conditions between the database storing the mint quote and the fake wallet paying the invoice of a yet not existing mint quote Add a delay of seconds before paying all invoices To recreate the slow conditions that would make our database slower than the external Fakewallet in Linux ``` sudo tc qdisc add dev lo root netem delay 200ms 50ms ionice -c3 nix develop -i -L .#stable --command just itest-payment-processor FAKEWALLET ``` To reset ``` sudo tc qdisc del dev lo root ``` --- crates/cdk-integration-tests/src/init_auth_mint.rs | 2 +- crates/cdk-integration-tests/src/init_pure_tests.rs | 2 +- crates/cdk-payment-processor/src/bin/payment_processor.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/cdk-integration-tests/src/init_auth_mint.rs b/crates/cdk-integration-tests/src/init_auth_mint.rs index bde2d0e1..63ca543e 100644 --- a/crates/cdk-integration-tests/src/init_auth_mint.rs +++ b/crates/cdk-integration-tests/src/init_auth_mint.rs @@ -33,7 +33,7 @@ where fee_reserve, HashMap::default(), HashSet::default(), - 0, + 2, CurrencyUnit::Sat, ); diff --git a/crates/cdk-integration-tests/src/init_pure_tests.rs b/crates/cdk-integration-tests/src/init_pure_tests.rs index 21c09056..9b46b804 100644 --- a/crates/cdk-integration-tests/src/init_pure_tests.rs +++ b/crates/cdk-integration-tests/src/init_pure_tests.rs @@ -247,7 +247,7 @@ pub async fn create_and_start_test_mint() -> Result { fee_reserve.clone(), HashMap::default(), HashSet::default(), - 0, + 2, CurrencyUnit::Sat, ); diff --git a/crates/cdk-payment-processor/src/bin/payment_processor.rs b/crates/cdk-payment-processor/src/bin/payment_processor.rs index d110583d..0ea98775 100644 --- a/crates/cdk-payment-processor/src/bin/payment_processor.rs +++ b/crates/cdk-payment-processor/src/bin/payment_processor.rs @@ -122,7 +122,7 @@ async fn main() -> anyhow::Result<()> { fee_reserve, HashMap::default(), HashSet::default(), - 0, + 2, cashu::CurrencyUnit::Sat, );