mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdhttp: use peer.String() in test
This commit is contained in:
parent
378cadf073
commit
908d326e22
@ -5,17 +5,15 @@ import "testing"
|
||||
//TODO: full testing for peer set
|
||||
func TestPeerSet(t *testing.T) {
|
||||
p := &Peers{}
|
||||
|
||||
p.Set("0x1=1.1.1.1")
|
||||
if p.Pick(0x1) != "http://1.1.1.1" {
|
||||
t.Errorf("pick = %s, want http://1.1.1.1", p.Pick(0x1))
|
||||
tests := []string{
|
||||
"1=1.1.1.1",
|
||||
"2=2.2.2.2",
|
||||
"1=1.1.1.1&1=1.1.1.2&2=2.2.2.2",
|
||||
}
|
||||
|
||||
p.Set("0x2=2.2.2.2")
|
||||
if p.Pick(0x1) != "" {
|
||||
t.Errorf("pick = %s, want empty string", p.Pick(0x1))
|
||||
}
|
||||
if p.Pick(0x2) != "http://2.2.2.2" {
|
||||
t.Errorf("pick = %s, want http://2.2.2.2", p.Pick(0x2))
|
||||
for i, tt := range tests {
|
||||
p.Set(tt)
|
||||
if p.String() != tt {
|
||||
t.Errorf("#%d: string = %s, want %s", i, p.String(), tt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user