go fmt
This commit is contained in:
@@ -102,7 +102,7 @@ func EnsureAssignmentsToActiveBrokers(activeBrokers cmap.ConcurrentMap[string, *
|
||||
assignment.LeaderBroker = ""
|
||||
count++
|
||||
}
|
||||
for i:=0; i<followerCount; i++ {
|
||||
for i := 0; i < followerCount; i++ {
|
||||
if i >= len(assignment.FollowerBrokers) {
|
||||
count++
|
||||
continue
|
||||
@@ -128,7 +128,7 @@ func EnsureAssignmentsToActiveBrokers(activeBrokers cmap.ConcurrentMap[string, *
|
||||
|
||||
hasEmptyFollowers := false
|
||||
j := 0
|
||||
for ; j<len(assignment.FollowerBrokers); j++ {
|
||||
for ; j < len(assignment.FollowerBrokers); j++ {
|
||||
if assignment.FollowerBrokers[j] == "" {
|
||||
hasChanges = true
|
||||
if i < len(pickedBrokers) {
|
||||
|
||||
@@ -86,19 +86,19 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) {
|
||||
singleActiveBroker := cmap.New[*BrokerStats]()
|
||||
singleActiveBroker.SetIfAbsent("localhost:1", &BrokerStats{})
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
hasChanges bool
|
||||
name string
|
||||
args args
|
||||
hasChanges bool
|
||||
}{
|
||||
{
|
||||
name: "test empty leader",
|
||||
args: args{
|
||||
activeBrokers: activeBrokers,
|
||||
followerCount: 1,
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
{
|
||||
LeaderBroker: "",
|
||||
Partition: &mq_pb.Partition{},
|
||||
Partition: &mq_pb.Partition{},
|
||||
FollowerBrokers: []string{
|
||||
"localhost:2",
|
||||
},
|
||||
@@ -112,10 +112,10 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) {
|
||||
args: args{
|
||||
activeBrokers: activeBrokers,
|
||||
followerCount: 1,
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
{
|
||||
LeaderBroker: "localhost:1",
|
||||
Partition: &mq_pb.Partition{},
|
||||
Partition: &mq_pb.Partition{},
|
||||
FollowerBrokers: []string{
|
||||
"",
|
||||
},
|
||||
@@ -129,10 +129,10 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) {
|
||||
args: args{
|
||||
activeBrokers: activeBrokers,
|
||||
followerCount: 1,
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
{
|
||||
LeaderBroker: "localhost:1",
|
||||
Partition: &mq_pb.Partition{},
|
||||
Partition: &mq_pb.Partition{},
|
||||
FollowerBrokers: []string{
|
||||
"localhost:200",
|
||||
},
|
||||
@@ -146,10 +146,10 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) {
|
||||
args: args{
|
||||
activeBrokers: activeBrokers,
|
||||
followerCount: 1,
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
{
|
||||
LeaderBroker: "localhost:100",
|
||||
Partition: &mq_pb.Partition{},
|
||||
Partition: &mq_pb.Partition{},
|
||||
FollowerBrokers: []string{
|
||||
"localhost:200",
|
||||
},
|
||||
@@ -163,10 +163,10 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) {
|
||||
args: args{
|
||||
activeBrokers: activeBrokers,
|
||||
followerCount: 3,
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
{
|
||||
LeaderBroker: "localhost:1",
|
||||
Partition: &mq_pb.Partition{},
|
||||
Partition: &mq_pb.Partition{},
|
||||
FollowerBrokers: []string{
|
||||
"localhost:2",
|
||||
},
|
||||
@@ -180,10 +180,10 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) {
|
||||
args: args{
|
||||
activeBrokers: activeBrokers,
|
||||
followerCount: 10,
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
{
|
||||
LeaderBroker: "localhost:1",
|
||||
Partition: &mq_pb.Partition{},
|
||||
Partition: &mq_pb.Partition{},
|
||||
FollowerBrokers: []string{
|
||||
"localhost:2",
|
||||
},
|
||||
@@ -197,10 +197,10 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) {
|
||||
args: args{
|
||||
activeBrokers: lowActiveBrokers,
|
||||
followerCount: 3,
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
{
|
||||
LeaderBroker: "localhost:1",
|
||||
Partition: &mq_pb.Partition{},
|
||||
Partition: &mq_pb.Partition{},
|
||||
FollowerBrokers: []string{
|
||||
"localhost:2",
|
||||
},
|
||||
@@ -214,10 +214,10 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) {
|
||||
args: args{
|
||||
activeBrokers: lowActiveBrokers,
|
||||
followerCount: 1,
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
{
|
||||
LeaderBroker: "localhost:1",
|
||||
Partition: &mq_pb.Partition{},
|
||||
Partition: &mq_pb.Partition{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -228,10 +228,10 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) {
|
||||
args: args{
|
||||
activeBrokers: singleActiveBroker,
|
||||
followerCount: 3,
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
assignments: []*mq_pb.BrokerPartitionAssignment{
|
||||
{
|
||||
LeaderBroker: "localhost:1",
|
||||
Partition: &mq_pb.Partition{},
|
||||
Partition: &mq_pb.Partition{},
|
||||
FollowerBrokers: []string{
|
||||
"localhost:2",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user