Skip to content

Commit

Permalink
broker: test create replica
Browse files Browse the repository at this point in the history
travisjeffery committed Oct 19, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 7a01fa4 commit 6e78979
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion broker/broker_test.go
Original file line number Diff line number Diff line change
@@ -934,13 +934,31 @@ func TestBroker_startReplica(t *testing.T) {
type args struct {
partition *jocko.Partition
}
partition := &jocko.Partition{
Topic: "the-topic",
ID: 1,
}
tests := []struct {
name string
fields fields
args args
want protocol.Error
}{
// TODO: Add test cases.
{
name: "started replica",
fields: fields{
topicMap: make(map[string][]*jocko.Partition),
serf: &mock.Serf{
MemberFn: func(id int32) *jocko.ClusterMember {
return nil
},
},
},
args: args{
partition: partition,
},
want: protocol.ErrNone,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -959,6 +977,13 @@ func TestBroker_startReplica(t *testing.T) {
if got := b.startReplica(tt.args.partition); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Broker.startReplica() = %v, want %v", got, tt.want)
}
got, err := b.partition(partition.Topic, partition.ID)
if !reflect.DeepEqual(got, partition) {
t.Errorf("Broker.partition() = %v, want %v", got, partition)
}
if err != protocol.ErrNone {
t.Errorf("Broker.partition() err = %v, want %v", err, protocol.ErrNone)
}
})
}
}

0 comments on commit 6e78979

Please sign in to comment.