server: broadcast leader changed

This commit is contained in:
nolouch
2018-09-17 12:02:24 +08:00
parent fd5ef74b80
commit c15fb607f6
4 changed files with 23 additions and 13 deletions

View File

@ -303,14 +303,14 @@ func TestDropReadUnderNetworkPartition(t *testing.T) {
clus.Members[leaderIndex].InjectPartition(t, clus.Members[(leaderIndex+1)%3], clus.Members[(leaderIndex+2)%3])
kvc := clientv3.NewKVFromKVClient(pb.NewKVClient(conn), nil)
ctx, cancel := context.WithTimeout(context.TODO(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.TODO(), 10*time.Second)
_, err = kvc.Get(ctx, "a")
cancel()
if err != rpctypes.ErrLeaderChanged {
t.Fatalf("expected %v, got %v", rpctypes.ErrLeaderChanged, err)
}
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
_, err = kvc.Get(ctx, "a")
cancel()
if err != nil {