Skip to content

Go SDK: Add unit tests for command serialization/deserialization #2883

Open

Description

@chengxilo

Description

The Go SDK contains numerous command types that implement the MarshalBinary interface to handle binary serialization. Currently, many of these implementations lack comprehensive unit tests, which is essential for ensuring data integrity and protocol compatibility.

Task

Add unit tests to verify the correctness of the MarshalBinary implementations for all command types. The tests should ensure that the serialized output matches the expected binary format used by the Iggy server.

Go Command Types: foreign/go/internal/command. You should write tests for them.

Activity

  1. changed the title [-]Go SDK Add unit tests for command serialization[/-] [+]Go SDK: Add unit tests for command serialization[/+] on Mar 6, 2026
  2. changed the title [-]Go SDK: Add unit tests for command serialization[/-] [+]Go SDK: Add unit tests for command serialization/deserialization[/+] on Mar 10, 2026
  3. saie-ch commented on Mar 11, 2026

    @saie-ch
    Contributor

    @mmodzelewski, please assign this to me. I'd like to work on this.

  4. added
    goPull requests that update go code
    sdkChange related to sdk (client) API
    testNew testcase, or improvement of existing
    on Sep 13, 2026
  5. justinmclean commented on Sep 13, 2026

    @justinmclean
    Member

    @saie-ch are you still working on this? If not I'll unassign it so someone else can pick it up.

  6. saie-ch commented on Sep 14, 2026

    @saie-ch
    Contributor

    @saie-ch are you still working on this? If not I'll unassign it so someone else can pick it up.

    @justinmclean please unassign :)

  7. justinmclean commented on Sep 21, 2026

    @justinmclean
    Member

    Checked foreign/go/internal/command against the current tree. 44 command types implement MarshalBinary, and 11 of them are exercised by a test. The remaining 33 are not, grouped by the file they live in:

    • access_token.go: CreatePersonalAccessToken, DeletePersonalAccessToken, GetPersonalAccessTokens
    • consumer_group.go: CreateConsumerGroup, DeleteConsumerGroup, GetConsumerGroup, GetConsumerGroups, JoinConsumerGroup, LeaveConsumerGroup, SyncConsumerGroup
    • offset.go: DeleteConsumerOffset, GetConsumerOffset, StoreConsumerOffsetRequest
    • partition.go: CreatePartitions, DeletePartitions
    • session.go: LoginWithPersonalAccessToken, LogoutUser
    • stream.go: DeleteStream, GetStream, GetStreams
    • system.go: DescribeOptions, GetClient, GetClients, GetClusterMetadata, GetStats, Ping
    • topic.go: DeleteTopic, GetTopic, GetTopics
    • user.go: ChangePassword, DeleteUser, GetUser, GetUsers

    The ones already covered are CreateStream, UpdateStream, CreateTopic, UpdateTopic, CreateUser, UpdateUser, UpdatePermissions, LoginUser, SendMessages, PollMessages and DeleteSegments, in stream_test.go, topic_test.go, update_user_test.go, session_test.go, message_test.go and segment_test.go. Those are the pattern to copy.

    One file is a self-contained piece of work, so this is worth picking up a file at a time rather than all 33 at once. system.go is the easiest start: six types, most of them taking no arguments.

    Counted by matching MarshalBinary receivers against type names appearing in the _test.go files, so a type that is referenced but not actually asserted on would show as covered. Treat the 33 as a floor.

  8. goutamadwant commented on Sep 26, 2026

    @goutamadwant
    Contributor

    @justinmclean pls assign this to me. thanks!

  9. justinmclean commented on Sep 26, 2026

    @justinmclean
    Member

    Thanks @goutamadwant all yours

  10. goutamadwant commented on Sep 26, 2026

    @goutamadwant
    Contributor

    @justinmclean I started with system.go in #4305. can you check if the test style look right? I’ll also continue file by file as suggested. But for the remaining work, would you prefer one file per PR, or small groups of related files. Let me know. thanks!

  11. justinmclean commented on Sep 28, 2026

    @justinmclean
    Member

    small groups of related files seem the easiest to review I think

  12. goutamadwant commented on Sep 29, 2026

    @goutamadwant
    Contributor

    Thanks @justinmclean. I’ve completed the session.go and user.go serialization tests as the next small batch. #4334
    will proceed with other batches while this gets reviewed.

  13. p4rtridge commented on Oct 17, 2026

    @p4rtridge

    Hi @justinmclean @goutamadwant Could I also be assigned to this issue? Thanks.

  14. justinmclean commented on Oct 22, 2026

    @justinmclean
    Member

    @goutamadwant only access_token.go is left without tests. Are you doing that one, or can @p4rtridge take it?

  15. p4rtridge commented on Oct 22, 2026

    @p4rtridge

    23. @goutamadwant only access_token.go is left without tests. Are you doing that one, or can @p4rtridge take it?

    Yeah, I'm happy to add it if @goutamadwant haven't started on it yet.

  16. goutamadwant commented on Oct 22, 2026

    @goutamadwant
    Contributor

    Thanks for checking @justinmclean. I started access_token.go locally, but I’m not ready to open a test PR ( have few things to take care before i open PR ). @p4rtridge, please go ahead with the remaining test coverage so I don’t hold up #2883. I won’t open an overlapping test PR.

  17. justinmclean commented on Oct 22, 2026

    @justinmclean
    Member

    @p4rtridge thanks, go ahead with access_token.go. I have added you as an assignee alongside goutamadwant.

  18. p4rtridge commented on Oct 25, 2026

    @p4rtridge

    27. @p4rtridge thanks, go ahead with access_token.go. I have added you as an assignee alongside goutamadwant.

    Thank you, @justinmclean. I have completed the serialization tests for access_token.go and opened #4640 for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

goPull requests that update go codegood first issueGood for newcomerssdkChange related to sdk (client) APItestNew testcase, or improvement of existing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions