Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

ENG 119 json rpc unit tests #1189

Merged
merged 31 commits into from
Jul 29, 2022
Merged

ENG 119 json rpc unit tests #1189

merged 31 commits into from
Jul 29, 2022

Conversation

danburck
Copy link
Contributor

@danburck danburck commented Jul 18, 2022

Description

This PR adds a few unit tests for the JSON RPC Backend. To isolate the backend code I mocked the

  • Tendermint RPC Server Queries
  • ethermint GRPC Server Queries

I want to merge this PR with partial coverage, because of the added mocks as well as the amount of methods in the JSON RPC.

@facs95, lets talk about refactoring the backend.go into several files. I also noticed the scope of the methods in rpc/namespaces/ethereum/eth/api.go is overlapping with backend.go

@codecov
Copy link

codecov bot commented Jul 25, 2022

Codecov Report

Merging #1189 (a2e79fe) into main (ebbffc6) will increase coverage by 1.91%.
The diff coverage is 23.07%.

❗ Current head a2e79fe differs from pull request most recent head 744093b. Consider uploading reports for the commit 744093b to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1189      +/-   ##
==========================================
+ Coverage   55.31%   57.22%   +1.91%     
==========================================
  Files          94       94              
  Lines        8376     8398      +22     
==========================================
+ Hits         4633     4806     +173     
+ Misses       3508     3349     -159     
- Partials      235      243       +8     
Impacted Files Coverage Δ
rpc/backend/backend.go 86.66% <ø> (ø)
rpc/backend/utils.go 2.31% <ø> (+2.31%) ⬆️
rpc/types/utils.go 0.00% <0.00%> (ø)
x/evm/keeper/grpc_query.go 69.06% <ø> (ø)
rpc/backend/evm_backend.go 24.50% <60.00%> (+23.51%) ⬆️

rpc/backend/client_test.go Outdated Show resolved Hide resolved
rpc/backend/evm_backend_test.go Outdated Show resolved Hide resolved
rpc/backend/evm_backend_test.go Outdated Show resolved Hide resolved
rpc/backend/evm_backend_test.go Outdated Show resolved Hide resolved
@danburck danburck marked this pull request as ready for review July 27, 2022 17:18
@danburck danburck requested a review from fedekunze as a code owner July 27, 2022 17:18
@fedekunze fedekunze added Type: Tests issues and PR related to tests C:JSON-RPC JSON-RPC client labels Jul 28, 2022
Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

rpc/types/utils_test.go Outdated Show resolved Hide resolved
rpc/backend/query_client_test.go Show resolved Hide resolved
rpc/backend/evm_backend_test.go Outdated Show resolved Hide resolved
rpc/backend/evm_backend_test.go Outdated Show resolved Hide resolved
rpc/backend/evm_backend_test.go Outdated Show resolved Hide resolved
rpc/backend/utils.go Outdated Show resolved Hide resolved
Copy link
Contributor

@facs95 facs95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides commented code in utils_test.go I think this looks good

@github-actions github-actions bot removed Type: Tests issues and PR related to tests C:JSON-RPC JSON-RPC client labels Jul 29, 2022
@danburck danburck enabled auto-merge (squash) July 29, 2022 10:12
@danburck danburck merged commit ee806fc into main Jul 29, 2022
@danburck danburck deleted the ENG-119-json-rpc-unit-tests branch July 29, 2022 10:35
facs95 pushed a commit that referenced this pull request Aug 12, 2022
* tests(json-rpc): wip evm_backend unit test setup

* tests(json-rpc): wip evm_backend unit test setup

* fix viper

* wip query client mock

* fix first backend test except error message

* clean up

* wip Context with Height

* fix JSON RPC backend test setup

* typo

* refactor folder structure

* tests(json-rpc):add BlockBloom tests

* tests(json-rpc): remove unused malleate

* tests(json-rpc): add BaseFee tests

* refactor query tests

* add client mock

* add GetTendermintBlockByNumber tests

* refactor mock tests

* refactor

* wip backend EthBlockFromTendermint test

* wip backend EthBlockFromTendermint test

* refactor backend EthBlockFromTendermint test

* add TestGetTendermintBlockResultByNumber

* add GetBlockByNumber tests

* refactor mocks

* fix spelling

* add more tests and address comments
hoanguyenkh pushed a commit to AstraProtocol/ethermint that referenced this pull request Aug 17, 2022
* tests(json-rpc): wip evm_backend unit test setup

* tests(json-rpc): wip evm_backend unit test setup

* fix viper

* wip query client mock

* fix first backend test except error message

* clean up

* wip Context with Height

* fix JSON RPC backend test setup

* typo

* refactor folder structure

* tests(json-rpc):add BlockBloom tests

* tests(json-rpc): remove unused malleate

* tests(json-rpc): add BaseFee tests

* refactor query tests

* add client mock

* add GetTendermintBlockByNumber tests

* refactor mock tests

* refactor

* wip backend EthBlockFromTendermint test

* wip backend EthBlockFromTendermint test

* refactor backend EthBlockFromTendermint test

* add TestGetTendermintBlockResultByNumber

* add GetBlockByNumber tests

* refactor mocks

* fix spelling

* add more tests and address comments
devon-chain pushed a commit to FunctionX/ethermint that referenced this pull request Nov 17, 2022
* tests(json-rpc): wip evm_backend unit test setup

* tests(json-rpc): wip evm_backend unit test setup

* fix viper

* wip query client mock

* fix first backend test except error message

* clean up

* wip Context with Height

* fix JSON RPC backend test setup

* typo

* refactor folder structure

* tests(json-rpc):add BlockBloom tests

* tests(json-rpc): remove unused malleate

* tests(json-rpc): add BaseFee tests

* refactor query tests

* add client mock

* add GetTendermintBlockByNumber tests

* refactor mock tests

* refactor

* wip backend EthBlockFromTendermint test

* wip backend EthBlockFromTendermint test

* refactor backend EthBlockFromTendermint test

* add TestGetTendermintBlockResultByNumber

* add GetBlockByNumber tests

* refactor mocks

* fix spelling

* add more tests and address comments

(cherry picked from commit 54f91b5)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants