Cosmos-sdk: Common test harness code for IBC tests

Created on 23 Jan 2020  路  7Comments  路  Source: cosmos/cosmos-sdk

De-duplicate this code & put it in a central location that can be imported.

ToDos:

  • [x] add x/ibc/testing/ pkg which sends through messages to create/update client, create connections/channels #6356
  • [x] remove testchain from channel keeper #6400
  • [x] remove testchain from connection keeper
  • [x] remove testchain from ibc/ante
  • [ ] remove testchain from clients

cc @fedekunze

code-hygiene help wanted meta-issue tests ibc

All 7 comments

I think #5691 is a dupe of this issue. Going to repost that content here cc @AdityaSripal

Tests on IBC require some cleanup along with end-to-end tests. Individual tasks include:

Cleanup:

  • [x] Cleaning up the TestChain methods and making them along with TestChain itself unexported
  • [x] Deleting all unused variables
  • [x] Commenting test functions so it is clear what they are intended to do
  • [x] Removing repeated code where possible (having a testing package within x/ibc with common test suite functionality could be useful).

Testing improvements:

  • [x] Create complete end to end tests that do nothing but start up 2 simapps and send messages to each other (which send & receive packets), while querying proofs as necessary
  • [x] Replace all mocked proofs with actual proofs retrieved from IAVL

Followup from #5711:

  • [x] Need to rewrite some of the failed test cases in 03-connection and 04-channel so that they fail for the stated reason in the test-case name
  • [x] Enforce consistency on connectionID naming through testsuites in 03-connection and 04-channel. Connection IDs are consistent within tests, but not across the entire test-suite which is important for understandability
  • [x] Write tests for TimeoutOnClose and CleanupPacket for ORDERED and UNORDERED channels
  • [x] De-duplify test setup code (mainly TestChain and queryProof) in 03-connection and 04-channel and move to separate test-utils package

from my look at testing so far, one good first step is to move TestChain/KeeperSuiteTest to a x/ibc/testing package. I can take this on if no one has started

I have not started, feel free to take this @colin-axner 馃憤

Following the merge of #6400, since the testing package will have stabilized in API, I think it'd be useful to do a pr for each file being updated rather than by pkg (as this has proved to result in a mega test refactor pr)

I'm starting on connection tests, will begin with handshake, then verify, then keeper

  • [x] handshake_test
  • [x] verify_test
  • [x] keeper_test

closing this issue since I believe the gist of it has been addressed. Any other test code that needs work or has issues should be opened with its own issue

Was this page helpful?
0 / 5 - 0 ratings