Node SDK: add unit tests for the cluster node and metadata deserialisers
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- nodejs, typescript
- Domain
- testing
Research direction
Read deserializeNode and deserializeMetadata in foreign/node/src/wire/cluster/cluster.utils.ts, and the role and status values in cluster.type.ts. Create cluster.utils.test.ts beside them, following the pattern in delete-topic.command.test.ts, with a helper that builds a node buffer from plain values. Done when the listed cases pass under npm run test:unit and npm run lint passes in foreign/node.
Written by the indexing model from the issue text.
Description
Description
deserializeNode and deserializeMetadata in foreign/node/src/wire/cluster/cluster.utils.ts have no unit test. deserializeNode reads a replica id, a length-prefixed name and IP, four uint16 ports, a role byte and a status byte, and throws when the buffer is too short at any step. deserializeMetadata reads a cluster name and a list of nodes. This is separate from #4968 and #4969, which add bounds checks to the client and consumer group deserialisers.
Affected area / component
Node SDK
Proposed solution
Add foreign/node/src/wire/cluster/cluster.utils.test.ts, modelled on foreign/node/src/wire/topic/delete-topic.command.test.ts. cluster.type.ts has the role and status values. A small helper in the test file that builds a node buffer from plain values lets each test change one field.
- Decode one hand-built node and check every field of the result, including
length. - Check the role and status names for each valid byte.
- Check that a buffer shorter than 19 bytes throws, and that a name length running past the end throws.
- Check that an unknown role byte throws
Invalid ClusterNodeRole. - Decode a metadata buffer with two nodes.
How to test: npm run test:unit and npm run lint pass in foreign/node.
Good first issue
- I think this could be a good first issue for a new contributor
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 548
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 194
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/iggy
-
go good first issue test
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
go good first issue test
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 2 days
-
go good first issue test
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
good first issue java test
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 2 days
-
good first issue javascript test
Difficulty 2/5 Half a day Newbie friendliness 85/100
Maintainers usually reply within 2 days
Similar issues
-
bug triaged tui ux wontfix
Difficulty 2/5 Half a day Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
bevyengine/bevy#26642 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day