فهرست منبع

fix(remove_node_test): remove unnecessary cluster configuration

The cluster configuration operation is originally to make sure
the instance won't be added back automatically between removal and
check for the number of existing peer-mode instances. But this
could make some node removed before the removal command.

Use longer sync interval instead to avoid this problem.
Yicheng Qin 12 سال پیش
والد
کامیت
e04a188358
1فایلهای تغییر یافته به همراه2 افزوده شده و 22 حذف شده
  1. 2 22
      tests/functional/remove_node_test.go

+ 2 - 22
tests/functional/remove_node_test.go

@@ -31,7 +31,7 @@ func TestRemoveNode(t *testing.T) {
 
 	c.SyncCluster()
 
-	resp, _ := tests.Put("http://localhost:7001/v2/admin/config", "application/json", bytes.NewBufferString(`{"activeSize":4, "syncInterval":1}`))
+	resp, _ := tests.Put("http://localhost:7001/v2/admin/config", "application/json", bytes.NewBufferString(`{"activeSize":4, "syncInterval":5}`))
 	if !assert.Equal(t, resp.StatusCode, 200) {
 		t.FailNow()
 	}
@@ -41,11 +41,6 @@ func TestRemoveNode(t *testing.T) {
 	client := &http.Client{}
 	for i := 0; i < 2; i++ {
 		for i := 0; i < 2; i++ {
-			r, _ := tests.Put("http://localhost:7001/v2/admin/config", "application/json", bytes.NewBufferString(`{"activeSize":3}`))
-			if !assert.Equal(t, r.StatusCode, 200) {
-				t.FailNow()
-			}
-
 			client.Do(rmReq)
 
 			fmt.Println("send remove to node3 and wait for its exiting")
@@ -76,12 +71,7 @@ func TestRemoveNode(t *testing.T) {
 				panic(err)
 			}
 
-			r, _ = tests.Put("http://localhost:7001/v2/admin/config", "application/json", bytes.NewBufferString(`{"activeSize":4}`))
-			if !assert.Equal(t, r.StatusCode, 200) {
-				t.FailNow()
-			}
-
-			time.Sleep(time.Second + time.Second)
+			time.Sleep(time.Second + 5*time.Second)
 
 			resp, err = c.Get("_etcd/machines", false, false)
 
@@ -96,11 +86,6 @@ func TestRemoveNode(t *testing.T) {
 
 		// first kill the node, then remove it, then add it back
 		for i := 0; i < 2; i++ {
-			r, _ := tests.Put("http://localhost:7001/v2/admin/config", "application/json", bytes.NewBufferString(`{"activeSize":3}`))
-			if !assert.Equal(t, r.StatusCode, 200) {
-				t.FailNow()
-			}
-
 			etcds[2].Kill()
 			fmt.Println("kill node3 and wait for its exiting")
 			etcds[2].Wait()
@@ -131,11 +116,6 @@ func TestRemoveNode(t *testing.T) {
 				panic(err)
 			}
 
-			r, _ = tests.Put("http://localhost:7001/v2/admin/config", "application/json", bytes.NewBufferString(`{"activeSize":4}`))
-			if !assert.Equal(t, r.StatusCode, 200) {
-				t.FailNow()
-			}
-
 			time.Sleep(time.Second + time.Second)
 
 			resp, err = c.Get("_etcd/machines", false, false)