diff --git a/src/test/jtx/impl/Env.cpp b/src/test/jtx/impl/Env.cpp index e219928e12..d872f06664 100644 --- a/src/test/jtx/impl/Env.cpp +++ b/src/test/jtx/impl/Env.cpp @@ -136,9 +136,15 @@ Env::close( auto resp = rpc("ledger_accept"); if (resp["result"]["status"] != std::string("success")) { - JLOG(journal.error()) - << "Env::close() failed: " << resp["result"]["status"] - << std::endl; + std::string reason = "internal error"; + if (resp.isMember("error_what")) + reason = resp["error_what"].asString(); + else if (resp.isMember("error_message")) + reason = resp["error_message"].asString(); + else if (resp.isMember("error")) + reason = resp["error"].asString(); + + JLOG(journal.error()) << "Env::close() failed: " << reason; res = false; } } diff --git a/src/test/rpc/Book_test.cpp b/src/test/rpc/Book_test.cpp index 81a9cfc724..93eb2849a7 100644 --- a/src/test/rpc/Book_test.cpp +++ b/src/test/rpc/Book_test.cpp @@ -1670,12 +1670,17 @@ public: Env env{*this, asAdmin ? envconfig() : envconfig(no_admin)}; Account gw{"gw"}; env.fund(XRP(200000), gw); - env.close(); + // Note that calls to env.close() fail without admin permission. + if (asAdmin) + env.close(); + auto USD = gw["USD"]; for (auto i = 0; i <= RPC::Tuning::bookOffers.rmax; i++) env(offer(gw, XRP(50 + 1 * i), USD(1.0 + 0.1 * i))); - env.close(); + + if (asAdmin) + env.close(); Json::Value jvParams; jvParams[jss::limit] = 1; diff --git a/src/test/rpc/LedgerData_test.cpp b/src/test/rpc/LedgerData_test.cpp index 2a43dc010d..1c55e90706 100644 --- a/src/test/rpc/LedgerData_test.cpp +++ b/src/test/rpc/LedgerData_test.cpp @@ -58,7 +58,9 @@ public: Account const bob{std::string("bob") + std::to_string(i)}; env.fund(XRP(1000), bob); } - env.close(); + // Note that calls to env.close() fail without admin permission. + if (asAdmin) + env.close(); // with no limit specified, we get the max_limit if the total number of // accounts is greater than max, which it is here @@ -107,7 +109,6 @@ public: Account const bob{std::string("bob") + std::to_string(i)}; env.fund(XRP(1000), bob); } - env.close(); // with no limit specified, we should get all of our fund entries // plus three more related to the gateway setup @@ -212,7 +213,6 @@ public: Account const bob{std::string("bob") + std::to_string(i)}; env.fund(XRP(1000), bob); } - env.close(); // with no limit specified, we should get all of our fund entries // plus three more related to the gateway setup diff --git a/src/test/rpc/LedgerRequestRPC_test.cpp b/src/test/rpc/LedgerRequestRPC_test.cpp index eff27fa68b..0896dadd51 100644 --- a/src/test/rpc/LedgerRequestRPC_test.cpp +++ b/src/test/rpc/LedgerRequestRPC_test.cpp @@ -360,7 +360,6 @@ public: Account const gw{"gateway"}; auto const USD = gw["USD"]; env.fund(XRP(100000), gw); - env.close(); auto const result = env.rpc("ledger_request", "1")[jss::result]; // The current HTTP/S ServerHandler returns an HTTP 403 error code here