Go SDK: add unit tests for ClusterNodeRole

Đang mở Phù hợp với người mới
#5,035 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
api

Hướng nghiên cứu

Các phương thức cần kiểm thử là ClusterNodeRoleTryFrom, MarshalBinary, UnmarshalBinary và String trong foreign/go/contracts/role.go. Hãy đọc compression_algorithm_test.go trong cùng thư mục để sao chép phong cách table-test sang một tệp role_test.go mới trong package iggcon. Bao phủ các byte 0, 1 và 2, vòng round trip nhị phân, các trường hợp lỗi nil và byte không hợp lệ, cùng ba đầu ra string. Hoàn thành khi go test ./contracts/... và go vet ./... chạy thành công trong foreign/go.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

go good first issue test
Description

ClusterNodeRoleTryFrom, MarshalBinary, UnmarshalBinary and String in foreign/go/contracts/role.go have no test of their own. ClusterNodeRoleTryFrom accepts only 0 (leader) and 1 (follower) and returns ierror.ErrInvalidCommand otherwise. UnmarshalBinary rejects an empty slice. String returns leader, follower or unknown. Other tests use the role constants as fixtures, but none checks these methods.

Affected area / component

Go SDK

Proposed solution

Add foreign/go/contracts/role_test.go in package iggcon, modelled on compression_algorithm_test.go in the same folder.

  • A table test over bytes 0, 1 and 2 for ClusterNodeRoleTryFrom, checking the value or the error.
  • A round trip through MarshalBinary and UnmarshalBinary.
  • Check that UnmarshalBinary(nil) and an invalid byte return the error.
  • Check the three String outputs.

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
Ngôn ngữ chính
Rust
Star
5.3k
Fork
548
Merge trung bình
2 ngày 20 giờ
Pull request đã merge (30 ngày)
194

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/iggy

Tất cả issue của apache/iggy

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.