mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
rename
This commit is contained in:
parent
1877ce5126
commit
dd1ec70e62
|
@ -8,7 +8,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func allocateTopicPartitions(brokers cmap.ConcurrentMap[string, *BrokerStats], partitionCount int32) (assignments []*mq_pb.BrokerPartitionAssignment) {
|
func AllocateTopicPartitions(brokers cmap.ConcurrentMap[string, *BrokerStats], partitionCount int32) (assignments []*mq_pb.BrokerPartitionAssignment) {
|
||||||
// divide the ring into partitions
|
// divide the ring into partitions
|
||||||
now := time.Now().UnixNano()
|
now := time.Now().UnixNano()
|
||||||
rangeSize := MaxPartitionCount / partitionCount
|
rangeSize := MaxPartitionCount / partitionCount
|
||||||
|
|
|
@ -53,7 +53,7 @@ func testThem(t *testing.T, tests []struct {
|
||||||
}) {
|
}) {
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
gotAssignments := allocateTopicPartitions(tt.args.brokers, tt.args.partitionCount)
|
gotAssignments := AllocateTopicPartitions(tt.args.brokers, tt.args.partitionCount)
|
||||||
assert.Equal(t, len(tt.wantAssignments), len(gotAssignments))
|
assert.Equal(t, len(tt.wantAssignments), len(gotAssignments))
|
||||||
for i, gotAssignment := range gotAssignments {
|
for i, gotAssignment := range gotAssignments {
|
||||||
assert.Equal(t, tt.wantAssignments[i].LeaderBroker, gotAssignment.LeaderBroker)
|
assert.Equal(t, tt.wantAssignments[i].LeaderBroker, gotAssignment.LeaderBroker)
|
||||||
|
|
Loading…
Reference in a new issue