mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: add test for cluster.String
This commit is contained in:
parent
4c9d67aaa2
commit
b9514ea265
@ -389,6 +389,49 @@ func TestClusterMembers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestClusterString(t *testing.T) {
|
||||||
|
cls := &Cluster{
|
||||||
|
members: map[uint64]*Member{
|
||||||
|
1: newTestMemberp(
|
||||||
|
1,
|
||||||
|
[]string{"http://1.1.1.1:1111", "http://0.0.0.0:0000"},
|
||||||
|
"abc",
|
||||||
|
nil,
|
||||||
|
),
|
||||||
|
2: newTestMemberp(
|
||||||
|
2,
|
||||||
|
[]string{"http://2.2.2.2:2222"},
|
||||||
|
"def",
|
||||||
|
nil,
|
||||||
|
),
|
||||||
|
3: newTestMemberp(
|
||||||
|
3,
|
||||||
|
[]string{"http://3.3.3.3:1234", "http://127.0.0.1:7001"},
|
||||||
|
"ghi",
|
||||||
|
nil,
|
||||||
|
),
|
||||||
|
// no PeerURLs = not included
|
||||||
|
4: newTestMemberp(
|
||||||
|
4,
|
||||||
|
[]string{},
|
||||||
|
"four",
|
||||||
|
nil,
|
||||||
|
),
|
||||||
|
5: newTestMemberp(
|
||||||
|
5,
|
||||||
|
nil,
|
||||||
|
"five",
|
||||||
|
nil,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
w := "abc=http://0.0.0.0:0000,abc=http://1.1.1.1:1111,def=http://2.2.2.2:2222,ghi=http://127.0.0.1:7001,ghi=http://3.3.3.3:1234"
|
||||||
|
if g := cls.String(); g != w {
|
||||||
|
t.Fatalf("Cluster.String():\ngot %#v\nwant %#v", g, w)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func TestClusterRemoveMember(t *testing.T) {
|
func TestClusterRemoveMember(t *testing.T) {
|
||||||
st := &storeRecorder{}
|
st := &storeRecorder{}
|
||||||
c := newTestCluster(nil)
|
c := newTestCluster(nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user