diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index 248c8121f4..844a3cd743 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -3530,9 +3530,18 @@ public: jv.isMember(jss::load_factor_fee_reference) && jv[jss::load_factor_fee_reference] == 256; })); - - BEAST_EXPECT( - !wsc->findMsg(1s, [&](auto const& jv) { return jv[jss::type] == "serverStatus"; })); + // Drain any extra serverStatus messages that may arrive + // asynchronously from the ledger close processing. The drain + // is bounded so the test cannot hang if serverStatus keeps + // arriving (e.g. LoadManager raising/lowering fees). + auto const drainDeadline = std::chrono::steady_clock::now() + 5s; + while (std::chrono::steady_clock::now() < drainDeadline) + { + if (!wsc->findMsg(1s, [&](auto const& jv) { return jv[jss::type] == "serverStatus"; })) + { + break; + } + } auto jv = wsc->invoke("unsubscribe", stream); BEAST_EXPECT(jv[jss::status] == "success"); diff --git a/src/test/basics/PerfLog_test.cpp b/src/test/basics/PerfLog_test.cpp index cd00b180e7..9a7d89efce 100644 --- a/src/test/basics/PerfLog_test.cpp +++ b/src/test/basics/PerfLog_test.cpp @@ -58,6 +58,17 @@ class PerfLog_test : public beast::unit_test::suite explicit Fixture(Application& app, beast::Journal j) : app_(app), j_(j) { + // Clean up any stale state from a previous test run. On + // self-hosted CI runners the temp directory persists between + // runs, so the "nasty file" test may have left a regular file + // (or a non-empty directory) at the logDir path. + // + // The error code is intentionally ignored: if the path doesn't + // exist (the common case on a clean runner) remove_all returns + // an error, and that's fine — there's nothing to clean up. + using namespace boost::filesystem; + boost::system::error_code ec; + remove_all(logDir(), ec); } ~Fixture()