Skip to content

Commit 66ce47e

Browse files
committed
add more tests
1 parent 00b2219 commit 66ce47e

File tree

9 files changed

+549
-73
lines changed

9 files changed

+549
-73
lines changed

common/types/sharddistributor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ package types
2424

2525
import "fmt"
2626

27-
//go:generate enumer -type=ExecutorStatus,ShardStatus,AssignmentStatus,MigrationMode -json -output sharddistributor_statuses_enumer_generated.go
27+
//go:generate enumer -type=ExecutorStatus,ShardStatus,AssignmentStatus,MigrationMode -trimprefix=ExecutorStatus,ShardStatus,AssignmentStatus,MigrationMode -json -output sharddistributor_statuses_enumer_generated.go
2828

2929
type GetShardOwnerRequest struct {
3030
ShardKey string
@@ -198,7 +198,7 @@ func (v *ExecutorHeartbeatResponse) GetMigrationPhase() (o MigrationMode) {
198198
}
199199

200200
type ShardAssignment struct {
201-
Status AssignmentStatus
201+
Status AssignmentStatus `json:"status"`
202202
}
203203

204204
func (v *ShardAssignment) GetStatus() (o AssignmentStatus) {

common/types/sharddistributor_statuses_enumer_generated.go

Lines changed: 55 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

service/sharddistributor/store/etcd/etcdkeys/etcdkeys.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ var validExecutorKeyTypes = map[ExecutorKeyType]struct{}{
5050
ExecutorMetadataKey: {},
5151
}
5252

53-
// isValidExecutorKeyType checks if the provided key type is valid.
54-
func isValidExecutorKeyType(keyType ExecutorKeyType) bool {
53+
// IsValidExecutorKeyType checks if the provided key type is valid.
54+
func IsValidExecutorKeyType(keyType ExecutorKeyType) bool {
5555
_, exist := validExecutorKeyTypes[keyType]
5656
return exist
5757
}
@@ -85,7 +85,7 @@ func ParseExecutorKey(prefix, namespace, key string) (executorID string, keyType
8585
if len(parts) != 2 {
8686
return "", "", fmt.Errorf("unexpected key format: %s", key)
8787
}
88-
if !isValidExecutorKeyType(ExecutorKeyType(parts[1])) {
88+
if !IsValidExecutorKeyType(ExecutorKeyType(parts[1])) {
8989
return "", "", fmt.Errorf("invalid executor key type: %s", parts[1])
9090
}
9191
return parts[0], ExecutorKeyType(parts[1]), nil

0 commit comments

Comments
 (0)