From 2abbb25bc3035a4042a8140b618e6b7888d08eda Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Wed, 9 Apr 2025 14:53:15 -0400 Subject: [PATCH] Fix unit test that fails with varying reference fee - Caused by a env.close() in the middle of the test that could change transaction ordering. Moved it to after the successful transaction that caused the later transactions to fail. --- src/test/app/Vault_test.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index c58fa065bf..478803dd62 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -1397,14 +1397,15 @@ class Vault_test : public beast::unit_test::suite env.fund(XRP(1000), issuer, owner, charlie); env.close(); - PrettyAsset asset = issuer["IOU"]; + PrettyAsset const asset = issuer["IOU"]; env.trust(asset(1000), owner); env(pay(issuer, owner, asset(200))); env(rate(issuer, 1.25)); env.close(); auto const issue = asset.raw().get(); - auto [tx, keylet] = vault.create({.owner = owner, .asset = asset}); + auto const [tx, keylet] = + vault.create({.owner = owner, .asset = asset}); env(tx); env.close(); @@ -1468,6 +1469,7 @@ class Vault_test : public beast::unit_test::suite { testcase("IOU froze trust line, cannot withdraw to 3rd party"); env(trust(issuer, asset(0), owner, tfSetFreeze)); + env.close(); auto tx = vault.withdraw( {.depositor = owner, .id = keylet.key, .amount = asset(10)}); @@ -1475,13 +1477,13 @@ class Vault_test : public beast::unit_test::suite tx[sfDestination] = charlie.human(); env(tx, ter{tecLOCKED}); // owner transitively locked via MPToken - env.close(); auto tx1 = test::jtx::pay(owner, charlie, STAmount{share, 10}); env(tx1, ter{tecLOCKED}); auto tx2 = test::jtx::pay(charlie, owner, STAmount{share, 10}); env(tx2, ter{tecLOCKED}); + env.close(); BEAST_EXPECT(env.balance(charlie, issue) == asset(20)); } @@ -1495,6 +1497,7 @@ class Vault_test : public beast::unit_test::suite tx[sfDestination] = issuer.human(); env(tx, ter{tecFROZEN}); + env.close(); } }