Improve Error Handling in GenerateAccountsWithKeyrings Function#2746
Improve Error Handling in GenerateAccountsWithKeyrings Function#2746nagarajdivine wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughFour integration test suites and a changelog were updated to refactor keyring initialization. Previously, a single ChangesKeyring Helper Refactoring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 4❌ Failed checks (4 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@x/ibcratelimit/client/cli/cli_test.go`:
- Around line 109-111: The helper GenerateAccountsWithKeyrings currently calls
testutil.NewTestKeyring and testutil.GenerateTestAccountsInKeyring which call
require.NoError internally and thus abort tests instead of returning errors;
change GenerateAccountsWithKeyrings to use error-returning variants (or accept
injectable factory functions) so keyring creation and account generation return
errors to the caller (e.g., make GenerateAccountsWithKeyrings return error and
propagate errors from testutil.NewTestKeyring and
testutil.GenerateTestAccountsInKeyring), allowing the test suite to choose
require.NoError or assert on failure paths.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d854266a-e524-4a7e-9b61-0e3ede2c0ddf
📒 Files selected for processing (5)
.changelog/unreleased/improvements/1970-keyring-helper.mdx/ibcratelimit/client/cli/cli_test.gox/marker/client/cli/cli_test.gox/metadata/client/cli/cli_test.gox/trigger/client/cli/cli_test.go
| s.keyringEntries, s.keyring = testutil.GenerateTestKeyring(s.T(), number, s.cfg.Codec) | ||
| s.keyring = testutil.NewTestKeyring(s.T(), s.cfg.Codec) | ||
| s.keyringEntries = testutil.GenerateTestAccountsInKeyring(s.T(), s.keyring, number) |
There was a problem hiding this comment.
tldr; I think we can just close the issue as done without doing a PR.
I think the one-liner is better than the split out version.
The ticket was originally about adding some unit tests to the testutil.GenerateTestKeyring func and its related functions, but that's a pain and I don't think it buys us anything. The secondary goal of the issue was to find all the places that do keyring stuff without using testutil.GenerateTestKeyring. I did a quick look through the CLI stuff and all I found was the quarantine module, but since we're getting rid of that, there isn't really anything to do there.
There was a problem hiding this comment.
We can close this PR 👍 , since there's already a PR for removing the quarantine module.
Description
closes: Improve Error Handling in GenerateAccountsWithKeyrings Function #1970
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/) or specification (x/<module>/spec/).godoccomments..changelog/unreleased(see Adding Changes).Files changedin the Github PR explorer.Codecov Reportin the comment section below once CI passes.Summary by CodeRabbit
Improvements
Tests