mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
clientv3/integration: add TestMemberAddUpdateWrongURLs
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
ab35c8fe3c
commit
c837e01c7f
@ -126,3 +126,36 @@ func TestMemberUpdate(t *testing.T) {
|
||||
t.Errorf("urls = %v, want %v", urls, resp.Members[0].PeerURLs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMemberAddUpdateWrongURLs(t *testing.T) {
|
||||
defer testutil.AfterTest(t)
|
||||
|
||||
clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1})
|
||||
defer clus.Terminate(t)
|
||||
|
||||
capi := clus.RandClient()
|
||||
tt := [][]string{
|
||||
// missing protocol scheme
|
||||
{"://127.0.0.1:2379"},
|
||||
// unsupported scheme
|
||||
{"mailto://127.0.0.1:2379"},
|
||||
// not conform to host:port
|
||||
{"http://127.0.0.1"},
|
||||
// contain a path
|
||||
{"http://127.0.0.1:2379/path"},
|
||||
// first path segment in URL cannot contain colon
|
||||
{"127.0.0.1:1234"},
|
||||
// URL scheme must be http, https, unix, or unixs
|
||||
{"localhost:1234"},
|
||||
}
|
||||
for i := range tt {
|
||||
_, err := capi.MemberAdd(context.Background(), tt[i])
|
||||
if err == nil {
|
||||
t.Errorf("#%d: MemberAdd err = nil, but error", i)
|
||||
}
|
||||
_, err = capi.MemberUpdate(context.Background(), 0, tt[i])
|
||||
if err == nil {
|
||||
t.Errorf("#%d: MemberUpdate err = nil, but error", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user