-
Notifications
You must be signed in to change notification settings - Fork 561
Fix failed integration tests due to the removal of amendments #3128
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
Fix failed integration tests due to the removal of amendments #3128
Conversation
WalkthroughThis PR disables several amendments in the rippled test configuration and introduces runtime amendment availability checks in integration tests, allowing tests to conditionally skip when required amendments are not enabled on the server. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/xrpl/test/integration/transactions/delegateSet.test.ts (1)
44-54: Consider using Mocha's test skipping mechanism for better test reporting.The early return pattern works functionally but causes the test to report as "passing" rather than "skipped" in test runners and CI/CD systems, which can hide that the test wasn't actually executed.
Consider refactoring to use Mocha's built-in skip functionality:
Option 1: Convert to regular function to use
this.skip()it( 'base', - async () => { + async function () { const isEnabled = await isAmendmentEnabled( testContext.client, 'PermissionDelegation', ) if (!isEnabled) { - // eslint-disable-next-line no-console -- Informing user about skipped test - console.warn( - 'Skipping DelegateSet test: PermissionDelegation amendment is not enabled on the server', - ) - return + this.skip() }Option 2: Conditionally define the test
Alternatively, check the amendment status in
beforeEachand use conditional test registration, though this is more complex and may not fit the current test structure.packages/xrpl/test/integration/utils.ts (1)
96-126: LGTM! Implementation is sound.The
isAmendmentEnabledfunction correctly queries the server's feature set and safely handles errors by defaulting to false. The logic is clear and the documentation is helpful.Optional: Consider adding type safety for feature objects.
While the current implementation works, you could improve type safety by defining an interface for the feature structure:
interface Feature { name: string enabled: boolean // other properties as needed }Then type the iteration more explicitly:
const features = featureResponse.result.features as Record<string, Feature> for (const feature of Object.values(features)) { // TypeScript now knows feature.name and feature.enabled are available if (feature.name === amendmentName) { return feature.enabled } }This would provide better IDE support and catch potential issues at compile time, though the current implementation is functional.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.ci-config/rippled.cfg(0 hunks)packages/xrpl/test/integration/transactions/delegateSet.test.ts(2 hunks)packages/xrpl/test/integration/utils.ts(1 hunks)
💤 Files with no reviewable changes (1)
- .ci-config/rippled.cfg
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: shawnxie999
Repo: XRPLF/xrpl.js PR: 2661
File: packages/xrpl/test/integration/transactions/clawback.test.ts:165-178
Timestamp: 2024-12-06T19:27:11.147Z
Learning: In the integration tests for `clawback.test.ts`, it's acceptable to use `ts-expect-error` to bypass type checking when verifying ledger entries, and no additional type safety improvements are needed.
Learnt from: shawnxie999
Repo: XRPLF/xrpl.js PR: 2661
File: packages/xrpl/test/integration/transactions/mptokenAuthorize.test.ts:29-118
Timestamp: 2024-12-06T19:25:15.376Z
Learning: In the XRPLF/xrpl.js TypeScript client library, when writing tests (e.g., in `packages/xrpl/test/integration/transactions/`), we generally do not need to test rippled server behaviors, because those behaviors are covered by rippled's own integration and unit tests.
Learnt from: ckeshava
Repo: XRPLF/xrpl.js PR: 2873
File: packages/xrpl/test/integration/transactions/trustSet.test.ts:0-0
Timestamp: 2025-01-31T17:46:25.375Z
Learning: For the XRPL implementation, extensive test cases for deep freeze behavior (high/low side interactions, clearing flags, etc.) are maintained in the C++ implementation and don't need to be duplicated in the JavaScript implementation.
Learnt from: ckeshava
Repo: XRPLF/xrpl.js PR: 2874
File: packages/xrpl/test/integration/transactions/permissionedDomain.test.ts:25-80
Timestamp: 2025-01-08T02:12:28.489Z
Learning: The rippled C++ implementation (PR #5161) includes comprehensive test coverage for PermissionedDomain (XLS-80d) error cases. The JS SDK tests focus on the happy path since the error cases are already validated at the rippled level, following the principle of not duplicating complex validation testing across SDK implementations.
📚 Learning: 2024-12-06T19:25:15.376Z
Learnt from: shawnxie999
Repo: XRPLF/xrpl.js PR: 2661
File: packages/xrpl/test/integration/transactions/mptokenAuthorize.test.ts:29-118
Timestamp: 2024-12-06T19:25:15.376Z
Learning: In the XRPLF/xrpl.js TypeScript client library, when writing tests (e.g., in `packages/xrpl/test/integration/transactions/`), we generally do not need to test rippled server behaviors, because those behaviors are covered by rippled's own integration and unit tests.
Applied to files:
packages/xrpl/test/integration/transactions/delegateSet.test.tspackages/xrpl/test/integration/utils.ts
📚 Learning: 2024-12-06T19:27:11.147Z
Learnt from: shawnxie999
Repo: XRPLF/xrpl.js PR: 2661
File: packages/xrpl/test/integration/transactions/clawback.test.ts:165-178
Timestamp: 2024-12-06T19:27:11.147Z
Learning: In the integration tests for `clawback.test.ts`, it's acceptable to use `ts-expect-error` to bypass type checking when verifying ledger entries, and no additional type safety improvements are needed.
Applied to files:
packages/xrpl/test/integration/transactions/delegateSet.test.ts
📚 Learning: 2024-12-06T18:44:55.095Z
Learnt from: shawnxie999
Repo: XRPLF/xrpl.js PR: 2661
File: packages/xrpl/test/models/MPTokenAuthorize.test.ts:60-71
Timestamp: 2024-12-06T18:44:55.095Z
Learning: In the XRPL.js library's TypeScript test file `packages/xrpl/test/models/MPTokenAuthorize.test.ts`, negative test cases for invalid `Account` address format, invalid `Holder` address format, invalid `MPTokenIssuanceID` format, and invalid flag combinations are not necessary.
Applied to files:
packages/xrpl/test/integration/transactions/delegateSet.test.ts
📚 Learning: 2025-01-31T17:46:25.375Z
Learnt from: ckeshava
Repo: XRPLF/xrpl.js PR: 2873
File: packages/xrpl/test/integration/transactions/trustSet.test.ts:0-0
Timestamp: 2025-01-31T17:46:25.375Z
Learning: For the XRPL implementation, extensive test cases for deep freeze behavior (high/low side interactions, clearing flags, etc.) are maintained in the C++ implementation and don't need to be duplicated in the JavaScript implementation.
Applied to files:
packages/xrpl/test/integration/transactions/delegateSet.test.ts
🧬 Code graph analysis (2)
packages/xrpl/test/integration/transactions/delegateSet.test.ts (1)
packages/xrpl/test/integration/utils.ts (1)
isAmendmentEnabled(103-126)
packages/xrpl/test/integration/utils.ts (1)
.ci-config/getNewAmendments.js (1)
client(15-15)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: browser (24.x)
- GitHub Check: unit (24.x)
- GitHub Check: unit (20.x)
- GitHub Check: integration (24.x)
- GitHub Check: integration (22.x)
- GitHub Check: integration (20.x)
- GitHub Check: unit (22.x)
- GitHub Check: Analyze (javascript)
- GitHub Check: build-and-lint (24.x)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
packages/xrpl/test/integration/transactions/delegateSet.test.ts (1)
18-22: LGTM!The import of
isAmendmentEnabledis correctly added and will enable runtime amendment checks.
High Level Overview of Change
Context of Change
Type of Change
Did you update HISTORY.md?
Test Plan