mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcd: clean testAdd
This commit is contained in:
parent
a0c0638744
commit
02922fa7a5
@ -76,20 +76,12 @@ func TestV2Redirect(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAdd(t *testing.T) {
|
func TestAdd(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []int{3, 4, 5, 6}
|
||||||
size int
|
|
||||||
round int
|
|
||||||
}{
|
|
||||||
{3, 5},
|
|
||||||
{4, 5},
|
|
||||||
{5, 5},
|
|
||||||
{6, 5},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
es := make([]*Server, tt.size)
|
es := make([]*Server, tt)
|
||||||
hs := make([]*httptest.Server, tt.size)
|
hs := make([]*httptest.Server, tt)
|
||||||
for i := 0; i < tt.size; i++ {
|
for i := 0; i < tt; i++ {
|
||||||
c := config.New()
|
c := config.New()
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
c.Peers = []string{hs[0].URL}
|
c.Peers = []string{hs[0].URL}
|
||||||
@ -99,7 +91,7 @@ func TestAdd(t *testing.T) {
|
|||||||
|
|
||||||
go es[0].Bootstrap()
|
go es[0].Bootstrap()
|
||||||
|
|
||||||
for i := 1; i < tt.size; i++ {
|
for i := 1; i < tt; i++ {
|
||||||
id := int64(i)
|
id := int64(i)
|
||||||
for {
|
for {
|
||||||
lead := es[0].node.Leader()
|
lead := es[0].node.Leader()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user