-
Notifications
You must be signed in to change notification settings - Fork 122
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
test: Audit some integration tests, make minor changes, and add plaintext test list #2089
Conversation
Note Reviews pausedUse the following commands to manage reviews:
📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 WalkthroughWalkthroughThe recent updates introduce a comprehensive GitHub Actions workflow to maintain testing documentation, enhance Makefile functionality for documentation testing, and significantly improve integration test documentation. Multiple new tests have been added to validate key functionalities, particularly related to blockchain operations, including rewards distribution, validator behavior, and misbehavior detection. These enhancements ensure better clarity in documentation and robust testing coverage, ultimately improving the reliability and maintainability of the codebase. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant GitHubActions as GA
participant Makefile as MF
participant Docs as D
participant Tests as T
Developer->>GA: Trigger events (PR, push)
GA->>MF: Execute testing-docs workflow
MF->>T: Run tests on integration changes
GA->>D: Update documentation if needed
D-->>Developer: Notify documentation status
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 16
Outside diff range, codebase verification and nitpick comments (13)
.github/workflows/testing-docs.yml (1)
42-52
: Step for checking for changes is appropriate but consider improving error messaging.The step correctly compares the generated documentation with the committed version and exits with an error if they differ. Consider adding more descriptive error messages for better clarity.
- echo "Documentation for integration tests is out of date. Please run `make testing-docs`!" + echo "Error: Documentation for integration tests is out of date. Please run `make testing-docs` to update it."scripts/test_doc/extract_docstrings.go (1)
64-79
: Docstring extraction logic is appropriate but consider usingos.ReadFile
.The
extractDocstrings
function reads the Go source file, creates the AST, and traverses it to extract docstrings. This logic is appropriate. However, consider usingos.ReadFile
instead ofioutil.ReadFile
asioutil
is deprecated.- src, err := ioutil.ReadFile(filePath) + src, err := os.ReadFile(filePath)tests/integration/slashing.go (8)
Line range hint
1-1
:
Ensure consistent import aliasing.The import alias for
evidencetypes
is redundant since it matches the package name.- evidencetypes "cosmossdk.io/x/evidence/types" + "github.com/cosmos/cosmos-sdk/x/evidence/types"
Line range hint
53-53
:
Check for nil error instead of usingNoError
.Using
NoError
is fine, but explicitly checking for nil error is more readable in some cases.- s.Require().Nil(err) + s.Require().NoError(err)
Line range hint
155-155
:
Check for nil error instead of usingNoError
.Using
NoError
is fine, but explicitly checking for nil error is more readable in some cases.- s.Require().Nil(err) + s.Require().NoError(err)
258-262
: Improve the function description.The long description placeholder should be replaced with a detailed explanation of the test's purpose.
-// @Long Description@ +// This test ensures that a slash packet sent from a consumer chain is properly acknowledged by the provider chain.
Line range hint
320-320
:
Check for nil error instead of usingNoError
.Using
NoError
is fine, but explicitly checking for nil error is more readable in some cases.- suite.Require().Nil(err) + suite.Require().NoError(err)
Line range hint
388-388
:
Check for nil error instead of usingNoError
.Using
NoError
is fine, but explicitly checking for nil error is more readable in some cases.- suite.Require().Nil(err) + suite.Require().NoError(err)
Line range hint
571-571
:
Check for nil error instead of usingNoError
.Using
NoError
is fine, but explicitly checking for nil error is more readable in some cases.- suite.Require().Nil(err) + suite.Require().NoError(err)
Line range hint
725-725
:
Check for nil error instead of usingNoError
.Using
NoError
is fine, but explicitly checking for nil error is more readable in some cases.- suite.Require().Nil(err) + suite.Require().NoError(err)tests/integration/distribution.go (3)
23-31
: Improve the function description.The long description placeholder should be replaced with a detailed explanation of the test's purpose.
-// @Long Description@ +// This test verifies the correct distribution of rewards from the consumer chain to the provider chain. +// It sets up the necessary channels, sends tokens to the fee pool, and checks their distribution. +// The test ensures that tokens are correctly allocated to the consumer and provider chains, +// and verifies the handling of rewards that are not whitelisted.
194-200
: Improve the function description.The long description placeholder should be replaced with a detailed explanation of the test's purpose.
-// @Long Description@ +// This test verifies the retry mechanism for failed reward transmissions. +// It sets up the necessary channels, fills the fee pool, and intentionally corrupts the transmission channel. +// The test then advances the block height to trigger a retry and confirms the successful transmission of rewards.
850-860
: Improve the function description.The long description placeholder should be replaced with a detailed explanation of the test's purpose.
-// @Long Description@ +// This test verifies the allocation of tokens to consumer validators under various scenarios. +// It sets up the provider chain, initializes consumer validators, and calls the AllocateTokensToConsumerValidators function. +// The test checks the expected token allocation to validators and covers different scenarios such as empty tokens, +// empty consumer validator set, single validator allocation, and multiple validator allocation.
@coderabbitai pause |
@coderabbitai resolve |
Co-authored-by: Marius Poke <[email protected]>
…security into ph/test-table
…security into ph/test-table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @p-offtermatt @kirdatatjana.
Description
Adds a script that generates a nice list of scenarios that are tested via integration tests.
Added missing docstrings and improved existing ones for several tests, along with a few minor fixes.
Extra notes:
This function interchain-security/testutil/keeper/unit_test_helpers.go
should use rapid instead. With rand, we only get one attempt at this per run, and it's impossible to trace back the original parameters if it ever fails.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
TESTING.md
to provide clearer guidelines for documenting integration tests, including schema requirements.Chores