Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add integration tests for feetiers module governance messages #459

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

tqin7
Copy link
Contributor

@tqin7 tqin7 commented Oct 4, 2023

No description provided.

@linear
Copy link

linear bot commented Oct 4, 2023

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 4, 2023

Walkthrough

The changes primarily revolve around enhancing the testing suite for the governance module of the protocol. New test cases have been added to verify the behavior of various functions under different scenarios. A significant addition across multiple test functions is the expectCheckTxFails field in the test struct, which is used to determine whether the checkTx function should fail or not. This field is passed as an argument to the respective function calls in each test case.

Changes

File(s) Change Summary
.../gov/feetiers_test.go Two test functions were added. One tests the MsgUpdatePerpetualFeeParams function under different scenarios. The other, TestUpdateFeeTiersModuleParams, tests the same function but with different failure scenarios.
.../gov/add_new_market_test.go Added a new field expectCheckTxFails to the test struct in the TestAddNewMarketProposal function.
.../gov/bridge_test.go Added the expectCheckTxFails field to the test struct in three test functions: TestUpdateEventParams, TestUpdateProposeParams, and TestUpdateSafetyParams.
.../gov/sending_test.go Added the expectCheckTxFails field to the test struct in the TestSendFromModuleToAccount function.
.../gov/stats_test.go Added the expectCheckTxFails field to the TestUpdateParams test function.
.../gov/vest_test.go Added two test functions: TestSetVestEntry and TestDeleteVestEntry, which test the behavior of the MsgSetVestEntry and MsgDeleteVestEntry messages respectively.
.../testutil/app/gov.go Added a new boolean parameter expectCheckTxFails to the SubmitAndTallyProposal function signature. The function now performs different assertions based on the value of expectCheckTxFails.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between 52e75d3 and 4d741fb.
Files selected for processing (1)
  • protocol/testing/e2e/gov/feetiers_test.go (1 hunks)
Additional comments (Suppressed): 1
protocol/testing/e2e/gov/feetiers_test.go (1)
  • 1-102: The test cases for MsgUpdatePerpetualFeeParams in x/feetiers are well structured and cover both success and failure scenarios. The use of table-driven tests makes it easy to add new test cases in the future. However, there is a potential issue with the way the test setup is done.

In line 76, you're creating a new instance of the test application for each test case. This could potentially slow down your tests if the number of test cases grows. Consider setting up a single instance of the test application before running the test cases and resetting the state as needed between test cases.

Also, consider adding more test cases to cover other edge cases or failure modes, such as invalid fee parameters or issues with the governance proposal process itself.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 3

Commits Files that changed from the base of the PR and between d259982 and 836bad7.
Files selected for processing (7)
  • protocol/testing/e2e/gov/add_new_market_test.go (2 hunks)
  • protocol/testing/e2e/gov/bridge_test.go (6 hunks)
  • protocol/testing/e2e/gov/feetiers_test.go (1 hunks)
  • protocol/testing/e2e/gov/sending_test.go (2 hunks)
  • protocol/testing/e2e/gov/stats_test.go (2 hunks)
  • protocol/testing/e2e/gov/vest_test.go (1 hunks)
  • protocol/testutil/app/gov.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • protocol/testing/e2e/gov/add_new_market_test.go
Additional comments (Suppressed): 12
protocol/testing/e2e/gov/sending_test.go (2)
  • 20-26: The new field expectCheckTxFails has been added to the test struct. Ensure that this field is properly set in all test cases and that its value correctly reflects whether the checkTx function should fail or not.

  • 105-111: The expectCheckTxFails field is now being passed as an argument to the SubmitAndTallyProposal function. Make sure that this function handles this new argument correctly, especially in terms of error handling and expected outcomes.

protocol/testing/e2e/gov/stats_test.go (2)
  • 17-23: The new field expectCheckTxFails has been added to the test struct. Ensure that all instances of this struct in the codebase have been updated accordingly.

  • 71-77: The function call now includes an additional argument tc.expectCheckTxFails. Make sure that the function signature has been updated everywhere it is defined and called.

protocol/testing/e2e/gov/bridge_test.go (6)
  • 20-25: The new field expectCheckTxFails has been added to the test struct. Ensure that this field is properly initialized in all test cases and its implications are correctly handled in the test logic.

  • 68-73: The function call now includes an additional argument tc.expectCheckTxFails. Make sure that the function definition has been updated to handle this new argument and it's used appropriately within the function.

  • 87-92: Similar to the previous comment, the new field expectCheckTxFails has been added to the test struct. Ensure that this field is properly initialized in all test cases and its implications are correctly handled in the test logic.

  • 136-142: The function call now includes an additional argument tc.expectCheckTxFails. Make sure that the function definition has been updated to handle this new argument and it's used appropriately within the function.

  • 155-161: Again, the new field expectCheckTxFails has been added to the test struct. Ensure that this field is properly initialized in all test cases and its implications are correctly handled in the test logic.

  • 201-207: The function call now includes an additional argument tc.expectCheckTxFails. Make sure that the function definition has been updated to handle this new argument and it's used appropriately within the function.

protocol/testutil/app/gov.go (2)
  • 35-41: The function signature has been updated to include a new parameter expectCheckTxFails. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.

  • 62-71: The new hunk introduces a conditional check for expectCheckTxFails which determines whether the CheckTx function should fail or not. This is a good practice as it allows for more granular control over the expected behavior of the test, improving its robustness.

protocol/testing/e2e/gov/vest_test.go Outdated Show resolved Hide resolved
protocol/testing/e2e/gov/vest_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7585cad and 8a38ffb.
Files selected for processing (1)
  • protocol/testing/e2e/gov/feetiers_test.go (1 hunks)

protocol/testing/e2e/gov/feetiers_test.go Outdated Show resolved Hide resolved
protocol/testing/e2e/gov/feetiers_test.go Outdated Show resolved Hide resolved
protocol/testing/e2e/gov/feetiers_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7585cad and 686d737.
Files selected for processing (1)
  • protocol/testing/e2e/gov/feetiers_test.go (1 hunks)

protocol/testing/e2e/gov/feetiers_test.go Show resolved Hide resolved
protocol/testing/e2e/gov/feetiers_test.go Show resolved Hide resolved
protocol/testing/e2e/gov/feetiers_test.go Show resolved Hide resolved
protocol/testing/e2e/gov/feetiers_test.go Show resolved Hide resolved
@tqin7 tqin7 merged commit cb7d7a1 into main Nov 28, 2023
14 of 15 checks passed
@tqin7 tqin7 deleted the tq/core-567-feetiers branch November 28, 2023 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants