Go SDK: add unit tests for TransportEndpoints
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
The methods under test are in foreign/go/contracts/transport_endpoints.go, and the new file foreign/go/contracts/transport_endpoints_test.go should follow the style of compression_algorithm_test.go in package iggcon. Read the encoding in MarshalBinary and UnmarshalBinary first, then check the issue's hand-computed bytes against the four port values. Done means go test ./contracts/... and go vet ./... pass in foreign/go, with cases for the marshal bytes, the round trip, the length-0 and length-7 errors, and the longer-slice case.
Written by the indexing model from the issue text.
Description
Description
NewTransportEndpoints, GetBufferSize, MarshalBinary and UnmarshalBinary in foreign/go/contracts/transport_endpoints.go have no test of their own. A cluster node carries four uint16 ports (TCP, QUIC, HTTP, WebSocket) in 8 little-endian bytes, and UnmarshalBinary returns ierror.ErrInvalidCommand when given fewer than 8. cluster_metadata_test.go reaches these methods only through a whole ClusterNode with only the TCP port set, so a swapped port order would not fail it, and the length check has no test.
Affected area / component
Go SDK
Proposed solution
Add foreign/go/contracts/transport_endpoints_test.go in package iggcon, modelled on compression_algorithm_test.go in the same folder. Work out the expected bytes by hand from the port numbers, so the test checks the layout rather than copying the output.
NewTransportEndpoints(8090, 8080, 3000, 8092)marshals to0x9A 0x1F 0x90 0x1F 0xB8 0x0B 0x9C 0x1F.- A round trip restores the same struct, and
GetBufferSizeis 8. - Slices of length 0 and 7 return the error, and a slice longer than 8 decodes the first 8 bytes.
How to test: go test ./contracts/... and go vet ./... pass in foreign/go.
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 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 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