mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rafthttp: test transport multiple transport removes
Unit test to verify multiple transport removes does not create an issue. Signed-off-by: Austin Benoit <22805659+AustinBenoit@users.noreply.github.com>
This commit is contained in:
@@ -142,6 +142,25 @@ func TestTransportRemove(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTransportRemoveIsIdempotent(t *testing.T) {
|
||||
tr := &Transport{
|
||||
LeaderStats: stats.NewLeaderStats(zaptest.NewLogger(t), ""),
|
||||
streamRt: &roundTripperRecorder{},
|
||||
peers: make(map[types.ID]Peer),
|
||||
pipelineProber: probing.NewProber(nil),
|
||||
streamProber: probing.NewProber(nil),
|
||||
}
|
||||
|
||||
tr.AddPeer(1, []string{"http://localhost:2380"})
|
||||
tr.RemovePeer(types.ID(1))
|
||||
tr.RemovePeer(types.ID(1))
|
||||
defer tr.Stop()
|
||||
|
||||
if _, ok := tr.peers[types.ID(1)]; ok {
|
||||
t.Fatalf("senders[1] exists, want removed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTransportUpdate(t *testing.T) {
|
||||
peer := newFakePeer()
|
||||
tr := &Transport{
|
||||
|
||||
Reference in New Issue
Block a user