-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Retry all RPC commands to fix MacOS CI jobs #5171
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5171 +/- ##
=========================================
- Coverage 77.9% 77.9% -0.0%
=========================================
Files 782 782
Lines 66621 66619 -2
Branches 8161 8158 -3
=========================================
- Hits 51902 51873 -29
- Misses 14719 14746 +27
|
* Follow up to XRPLF#5120 (23991c9), which added a retry for submit commands. It improved MacOS test reliability, but other tests are failing now. * Retry all failed RPC connections / commands in unit tests.
* upstream/develop: Add hubs.xrpkuwait.com to bootstrap (5169)
* upstream/develop: Add AMMClawback Transaction (XLS-0073d) (5142)
* upstream/develop: Fix unity build (5179)
src/test/jtx/Env.h
Outdated
@@ -292,6 +292,17 @@ class Env | |||
The command is examined and used to build | |||
the correct JSON as per the arguments. | |||
*/ | |||
using rpcCallback = std::function<bool(Json::Value const&)>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we capitalize the name (RpcCallback
)?
Please add a comment like "Given the return value of an RPC, returns true if it is acceptable."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Fixed.
src/test/jtx/impl/Env.cpp
Outdated
static auto const defaultCallback = [](Json::Value const& jr) { | ||
auto const parsedResult = parseResult(jr, false); | ||
return parsedResult.rpcCode != rpcINTERNAL; | ||
}; | ||
cb = defaultCallback; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this out of the function, into the definition of useDefaultCallback
(either inline or extern), and rename useDefaultCallback
to something like rejectInternalError
? If you prefer to frame the predicate names as accept{Condition}
instead of reject{Condition}
, then I'd be fine with that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Fixed.
src/test/jtx/Env.h
Outdated
@@ -292,6 +292,17 @@ class Env | |||
The command is examined and used to build | |||
the correct JSON as per the arguments. | |||
*/ | |||
using rpcCallback = std::function<bool(Json::Value const&)>; | |||
const rpcCallback useDefaultCallback{}; | |||
const rpcCallback expectInternalRPCError = [](Json::Value const&) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this to rejectNever
and add a comment explaining that it is meant to be used for tests that expect an internal error and do not want to trigger a retry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Fixed.
src/test/jtx/Env.h
Outdated
getInternalFailureCallback(bool shouldFail) | ||
{ | ||
return shouldFail ? expectInternalRPCError : useDefaultCallback; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this to rejectInternalErrorIf
?
src/test/jtx/Env.h
Outdated
@@ -514,7 +536,7 @@ class Env | |||
/** Gets the TER result and `didApply` flag from a RPC Json result object. | |||
*/ | |||
static ParsedResult | |||
parseResult(Json::Value const& jr); | |||
parseResult(Json::Value const& jr, bool checkTER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand what this parameter is supposed to be doing. Can we add an explanation in the docstring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more checks, and I was able to get rid of checkTER
entirely. The intention was to flag whether the request was related to submitting a transaction, and thus a TER
would be expected in the result. There is no TER
in the result if there isn't a transaction.
* upstream/develop: Set version to 2.3.0-rc1 Replace Uint192 with Hash192 in server_definitions response (5177) Fix potential deadlock (5124) Introduce Credentials support (XLS-70d): (5103) Fix token comparison in Payment (5172) Add fixAMMv1_2 amendment (5176)
* Rename the RpcCallback type, and the default variables of that type * Move the "default callback" out of the retry logic, and into the variable definition. * Get rid of the checkTER parameter to parseResult.
* upstream/develop: fix: include `index` in `server_definitions` RPC (5190) Fix ledger_entry crash on invalid credentials request (5189)
@thejohnfreeman @vlntb I want to bring your attention to draft PR #5180. It builds on top of this PR, but adds three commits:
I would like to roll those changes into this PR so we can get the MacOS jobs fixed all in one shot. Do you think that's a good idea, or should that be a separate PR to be merged separately sometime after this one? |
* upstream/develop: Set version to 2.3.0-rc2
I don't see any approvals in here yet, so I say roll them into this PR. |
* Add a lot more retries across test network operations. * Add some network error logging details.
High Level Overview of Change
Retry all failed RPC connections / commands in unit tests.
Context of Change
Follow up to #5120 (23991c9), which added a retry for submit commands. It improved MacOS test reliability, but other tests are failing now.
Type of Change