|
@@ -97,10 +97,10 @@ func TestTransportCutMend(t *testing.T) {
|
|
|
func TestTransportAdd(t *testing.T) {
|
|
func TestTransportAdd(t *testing.T) {
|
|
|
ls := stats.NewLeaderStats("")
|
|
ls := stats.NewLeaderStats("")
|
|
|
tr := &Transport{
|
|
tr := &Transport{
|
|
|
- LeaderStats: ls,
|
|
|
|
|
- streamRt: &roundTripperRecorder{},
|
|
|
|
|
- peers: make(map[types.ID]Peer),
|
|
|
|
|
- prober: probing.NewProber(nil),
|
|
|
|
|
|
|
+ LeaderStats: ls,
|
|
|
|
|
+ streamRt: &roundTripperRecorder{},
|
|
|
|
|
+ peers: make(map[types.ID]Peer),
|
|
|
|
|
+ pipelineProber: probing.NewProber(nil),
|
|
|
}
|
|
}
|
|
|
tr.AddPeer(1, []string{"http://localhost:2380"})
|
|
tr.AddPeer(1, []string{"http://localhost:2380"})
|
|
|
|
|
|
|
@@ -125,10 +125,10 @@ func TestTransportAdd(t *testing.T) {
|
|
|
|
|
|
|
|
func TestTransportRemove(t *testing.T) {
|
|
func TestTransportRemove(t *testing.T) {
|
|
|
tr := &Transport{
|
|
tr := &Transport{
|
|
|
- LeaderStats: stats.NewLeaderStats(""),
|
|
|
|
|
- streamRt: &roundTripperRecorder{},
|
|
|
|
|
- peers: make(map[types.ID]Peer),
|
|
|
|
|
- prober: probing.NewProber(nil),
|
|
|
|
|
|
|
+ LeaderStats: stats.NewLeaderStats(""),
|
|
|
|
|
+ streamRt: &roundTripperRecorder{},
|
|
|
|
|
+ peers: make(map[types.ID]Peer),
|
|
|
|
|
+ pipelineProber: probing.NewProber(nil),
|
|
|
}
|
|
}
|
|
|
tr.AddPeer(1, []string{"http://localhost:2380"})
|
|
tr.AddPeer(1, []string{"http://localhost:2380"})
|
|
|
tr.RemovePeer(types.ID(1))
|
|
tr.RemovePeer(types.ID(1))
|
|
@@ -142,8 +142,8 @@ func TestTransportRemove(t *testing.T) {
|
|
|
func TestTransportUpdate(t *testing.T) {
|
|
func TestTransportUpdate(t *testing.T) {
|
|
|
peer := newFakePeer()
|
|
peer := newFakePeer()
|
|
|
tr := &Transport{
|
|
tr := &Transport{
|
|
|
- peers: map[types.ID]Peer{types.ID(1): peer},
|
|
|
|
|
- prober: probing.NewProber(nil),
|
|
|
|
|
|
|
+ peers: map[types.ID]Peer{types.ID(1): peer},
|
|
|
|
|
+ pipelineProber: probing.NewProber(nil),
|
|
|
}
|
|
}
|
|
|
u := "http://localhost:2380"
|
|
u := "http://localhost:2380"
|
|
|
tr.UpdatePeer(types.ID(1), []string{u})
|
|
tr.UpdatePeer(types.ID(1), []string{u})
|
|
@@ -156,13 +156,13 @@ func TestTransportUpdate(t *testing.T) {
|
|
|
func TestTransportErrorc(t *testing.T) {
|
|
func TestTransportErrorc(t *testing.T) {
|
|
|
errorc := make(chan error, 1)
|
|
errorc := make(chan error, 1)
|
|
|
tr := &Transport{
|
|
tr := &Transport{
|
|
|
- Raft: &fakeRaft{},
|
|
|
|
|
- LeaderStats: stats.NewLeaderStats(""),
|
|
|
|
|
- ErrorC: errorc,
|
|
|
|
|
- streamRt: newRespRoundTripper(http.StatusForbidden, nil),
|
|
|
|
|
- pipelineRt: newRespRoundTripper(http.StatusForbidden, nil),
|
|
|
|
|
- peers: make(map[types.ID]Peer),
|
|
|
|
|
- prober: probing.NewProber(nil),
|
|
|
|
|
|
|
+ Raft: &fakeRaft{},
|
|
|
|
|
+ LeaderStats: stats.NewLeaderStats(""),
|
|
|
|
|
+ ErrorC: errorc,
|
|
|
|
|
+ streamRt: newRespRoundTripper(http.StatusForbidden, nil),
|
|
|
|
|
+ pipelineRt: newRespRoundTripper(http.StatusForbidden, nil),
|
|
|
|
|
+ peers: make(map[types.ID]Peer),
|
|
|
|
|
+ pipelineProber: probing.NewProber(nil),
|
|
|
}
|
|
}
|
|
|
tr.AddPeer(1, []string{"http://localhost:2380"})
|
|
tr.AddPeer(1, []string{"http://localhost:2380"})
|
|
|
defer tr.Stop()
|
|
defer tr.Stop()
|