qicosmos / rest_rpc

modern C++(C++11), simple, easy to use rpc framework
MIT License
1.66k stars 365 forks source link

add exception test #136

Closed try-agaaain closed 3 months ago

try-agaaain commented 3 months ago

119

Through the lcov tool, I observed that functions such as router::get_name_by_key and rest_rpc::get_error_msg were not covered by tests. These functions will be triggered when exceptions occur, so I added some exception tests.

github-actions[bot] commented 3 months ago

Code Coverage Report for detail, goto summary download Artifacts

Filename                    Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
client_util.hpp                     4                 1    75.00%          25                10    60.00%           4                 2    50.00%
codec.h                             4                 0   100.00%          24                 2    91.67%           0                 0         -
connection.h                       40                 4    90.00%         380                93    75.53%          72                37    48.61%
io_service_pool.h                   5                 0   100.00%          32                 1    96.88%          12                 1    91.67%
md5.hpp                            19                 2    89.47%         127                 8    93.70%          24                 0   100.00%
router.h                           19                 2    89.47%         144                35    75.69%           4                 3    25.00%
rpc_client.hpp                     74                 6    91.89%         669               120    82.06%         132                56    57.58%
rpc_server.h                       28                 3    89.29%         205                20    90.24%          44                10    77.27%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             193                18    90.67%        1606               289    82.00%         292               109    62.67%
try-agaaain commented 3 months ago

It seems that the code coverage in the report given by github action has not improved, but there is a slight improvement in the lcov report:

image

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 90.73482% with 29 lines in your changes are missing coverage. Please review.

Project coverage is 55.57%. Comparing base (44392e4) to head (1883731).

Files Patch % Lines
tests/test_rest_rpc.cpp 90.73% 29 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #136 +/- ## ========================================== + Coverage 54.76% 55.57% +0.80% ========================================== Files 164 163 -1 Lines 7945 7939 -6 ========================================== + Hits 4351 4412 +61 + Misses 3594 3527 -67 ```

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

github-actions[bot] commented 3 months ago

Code Coverage Report for detail, goto summary download Artifacts

Filename                    Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
client_util.hpp                     4                 1    75.00%          25                10    60.00%           4                 2    50.00%
codec.h                             4                 0   100.00%          24                 2    91.67%           0                 0         -
connection.h                       40                 4    90.00%         380                93    75.53%          72                37    48.61%
io_service_pool.h                   5                 0   100.00%          32                 1    96.88%          12                 1    91.67%
md5.hpp                            19                 2    89.47%         127                 8    93.70%          24                 0   100.00%
router.h                           19                 2    89.47%         144                35    75.69%           4                 3    25.00%
rpc_client.hpp                     74                 6    91.89%         669               120    82.06%         132                56    57.58%
rpc_server.h                       28                 3    89.29%         205                20    90.24%          44                10    77.27%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             193                18    90.67%        1606               289    82.00%         292               109    62.67%
github-actions[bot] commented 3 months ago

Code Coverage Report for detail, goto summary download Artifacts

Filename                    Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
client_util.hpp                     4                 1    75.00%          25                10    60.00%           4                 2    50.00%
codec.h                             4                 0   100.00%          24                 2    91.67%           0                 0         -
connection.h                       40                 4    90.00%         380                93    75.53%          72                37    48.61%
io_service_pool.h                   5                 0   100.00%          32                 1    96.88%          12                 1    91.67%
md5.hpp                            19                 2    89.47%         127                 8    93.70%          24                 0   100.00%
router.h                           19                 2    89.47%         144                35    75.69%           4                 3    25.00%
rpc_client.hpp                     74                 6    91.89%         669               120    82.06%         132                56    57.58%
rpc_server.h                       28                 3    89.29%         205                20    90.24%          44                10    77.27%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                             193                18    90.67%        1606               289    82.00%         292               109    62.67%