gaia icon indicating copy to clipboard operation
gaia copied to clipboard

Refactor: e2e test

Open yaruwangway opened this issue 1 year ago • 2 comments

Summary

More e2e tests are added to test different tx/queries for a gaiad chain. the following refactor will be done to improve the code

  • [ ] when paying fees, all the tx cli use --fees rather than --gas-prices
  • [ ] refator ssubmitLegacyProposalFundGovAccount to submitLegacyProposal
  • [ ] refactor banksend to include fees as argument
  • [ ] tidy up variables in e2e_setup_test.go
  • [ ] refactor executeGaiaTxCommand with consider expectedErr like withdrawReward and sendMsgSend , so that withdrawReward and sendMsgSend can also use it.
  • [ ] pr https://github.com/cosmos/gaia/pull/1652
  • [ ] pass fees as argument to submitNewGovProposal
  • [ ] add check err code: 13, insufficient fees.
  • [ ] move submit, deposit voteGovProposal to e2e_cli_util.go
  • [ ] separate relayer accounts from normal accounts
  • [ ] avoid to hardcode the gaia home folder /home/nonroot/.gaia/config/ica_bank_send.json
  • [ ] define consts for all generated json files: ica_bank_send.json, proposal.json etc
  • [ ] check if all the sleeps in tests are necessary.

Problem Definition

Proposal


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
  • [ ] Is a spike necessary to map out how the issue should be approached?
  • [ ] refactor exeGaiacmd into pass and fail cases

yaruwangway avatar Jul 25 '22 10:07 yaruwangway

  • [ ] Rename the prefix from helpers methods from query... to check.... E.g. func queryGaiaTx(endpoint, txHash string) error this method does the query in the middle of the method but does not represent a query method returning the response values.
  • [ ] Create real query methods we can use in the new check methods above.
  • [ ] Avoid using common, util, shared, or lib as a package or filenames. These are bad, uninformative names.

Pantani avatar Sep 06 '22 16:09 Pantani

  • [ ] Use subtest (s.Run("<DESCRIPTION>", func() {}) for we can tracke better issues;
  • [ ] Avoid too many global vars. The variable can live in the primary structure;
  • [ ] Split libraries into packages. E.g.: genesis package should handle genesis logic;
  • [ ] Too many methods to manipulate the genesis. Tries Manipulate the genesis only one time before launch;
  • [ ] Gaiad commands can run locally without exec into the container;
  • [ ] Avoid creating extensions to change the current object. E.g.: initValidatorConfigs change all states of IntegrationTestSuite. Without knowing the code, we cannot know the lifecycle of the vars; 
- [ ] Split the e2e_util_test.go file into e2e_exec_test.go, e2e_query_test.go and e2e_ibc_test.go
  • [ ] Add the ability to initiate how many chains we need for the tests. We can pass the number of chains we want and store them in a chain slice;
  • [ ] Automatically use the other chain API endpoint if we select another chain;
  • [ ] Add a map of all reusable global flags to IntegrationTestSuite so we can avoid passing values everytime like the home folder for each command;
  • [ ] Pass the optional flags to the exec method as a variadic variable. E.g., https://github.com/cosmos/gaia/pull/1738/files#diff-fa97566cde4f0e8006578cd218b1986e64bd02b6ff21f6286bd1c2678087cd6cR10-R53;
  • [ ] Avoid big functions
  • [ ] Avoid too many generic var names for globals. Use consistency in methods naming in the entire project. E.g.: LoadFile, LoadImageFromFile, GenerateFilePeriod, GetTx, CheckTx;
  • [ ] Parse stderr for TxResponse and throw the error if the code is not zero;

Pantani avatar Sep 19 '22 03:09 Pantani

this is outdated.

yaruwangway avatar Sep 29 '23 11:09 yaruwangway