rippled icon indicating copy to clipboard operation
rippled copied to clipboard

test: env unit test RPC errors return a unique result:

Open ximinez opened this issue 1 year ago • 6 comments

High Level Overview of Change

Changes the error used in unit tests submit returns an RPC error (including failed connections, etc.) from temINVALID to telLOCAL_ERROR. Also adds a few log messages that should be helpful to diagnose some test failure cases, and changes the description of telLOCAL_ERROR.

Context of Change

temINVALID is currently returned when submit gets an RPC failure, but it is also used in several places in the transaction engine. This can make diagnosing test failures, especially spurious test failures, confusing and annoying to debug. telLOCAL_ERROR is not new, but it is not used anywhere in the transaction engine. This will make those types of errors distinct and easier to diagnose. I did not create a new code, because the available numeric range for codes is large, but not unlimited, and it's wasteful to create a new one when there's one which fits the purpose already available.

Type of Change

  • [X ] Tests (you added tests for code that already exists, or your new feature included in this PR)

API Impact

None.

Before / After

No externally visible effects when things are working correctly.

Test Plan

Since this is limited to unit tests, there is no need for additional testing if those tests pass.

ximinez avatar Jan 18 '24 00:01 ximinez

@scottschurr @ckeshava The discussion in https://github.com/XRPLF/rippled/pull/4846#discussion_r1454285073 finally prompted me to clean up this branch enough to create a PR.

ximinez avatar Jan 18 '24 00:01 ximinez

I observed two other unit tests that are using temINVALID. I think they should use telLOCAL_ERROR instead. here is a branch with the change: https://github.com/ckeshava/rippled/tree/ed-localerr

I'd prefer to use telUNIT_TEST_ERR instead of telLOCAL_ERR, because it's more readable. Although telLOCAL_ERR hasn't been used, I'm guessing we can't alias it with any other name right?

ckeshava avatar Jan 18 '24 21:01 ckeshava

Sorry, my bad. Ignore the above modifications to the Ticket and PseudoTx test classes. Your changes are correct as is

ckeshava avatar Jan 19 '24 00:01 ckeshava

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 76.94%. Comparing base (af9cabe) to head (56f90dd).

:exclamation: Current head 56f90dd differs from pull request most recent head 47b7535. Consider uploading reports for the commit 47b7535 to get more accurate results

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4887   +/-   ##
========================================
  Coverage    76.94%   76.94%           
========================================
  Files         1127     1127           
  Lines       131675   131690   +15     
  Branches     39609    39571   -38     
========================================
+ Hits        101320   101333   +13     
+ Misses       24446    24416   -30     
- Partials      5909     5941   +32     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Jan 23 '24 00:01 codecov-commenter

@scottschurr Ok, I'm convinced. I grabbed your commit.

ximinez avatar Feb 14 '24 22:02 ximinez

  • awaiting Passed label by ximinez

intelliot avatar Feb 17 '24 01:02 intelliot

Suggested squash commit message:

test: Env unit test RPC errors return a unique result: (#4877)

* telENV_RPC_FAILED is a new code, reserved exclusively
  for unit tests when RPC fails unexpectedly. This will
  make those types of errors distinct and easier to test
  for when expect and/or diagnose when not.

ximinez avatar Feb 29 '24 03:02 ximinez