Browse Source

tests: remove unnecessary test

Xiang Li 11 years ago
parent
commit
a0c0638744
2 changed files with 0 additions and 115 deletions
  1. 0 43
      tests/functional/cluster_config_test.go
  2. 0 72
      tests/functional/single_node_test.go

+ 0 - 43
tests/functional/cluster_config_test.go

@@ -2,7 +2,6 @@ package test
 
 import (
 	"bytes"
-	"encoding/json"
 	"os"
 	"testing"
 	"time"
@@ -11,25 +10,6 @@ import (
 	"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
 )
 
-// Ensure that the cluster configuration can be updated.
-func TestClusterConfigSet(t *testing.T) {
-	_, etcds, err := CreateCluster(3, &os.ProcAttr{Files: []*os.File{nil, os.Stdout, os.Stderr}}, false)
-	assert.NoError(t, err)
-	defer DestroyCluster(etcds)
-
-	resp, _ := tests.Put("http://localhost:7001/v2/admin/config", "application/json", bytes.NewBufferString(`{"activeSize":3, "removeDelay":60}`))
-	assert.Equal(t, resp.StatusCode, 200)
-
-	time.Sleep(1 * time.Second)
-
-	resp, _ = tests.Get("http://localhost:7002/v2/admin/config")
-	body := tests.ReadBodyJSON(resp)
-	assert.Equal(t, resp.StatusCode, 200)
-	assert.Equal(t, resp.Header.Get("Content-Type"), "application/json")
-	assert.Equal(t, body["activeSize"], 3)
-	assert.Equal(t, body["removeDelay"], 60)
-}
-
 // Ensure that the cluster configuration can be reloaded.
 func TestClusterConfigReload(t *testing.T) {
 	procAttr := &os.ProcAttr{Files: []*os.File{nil, os.Stdout, os.Stderr}}
@@ -65,26 +45,3 @@ func TestClusterConfigReload(t *testing.T) {
 	assert.Equal(t, body["activeSize"], 3)
 	assert.Equal(t, body["removeDelay"], 60)
 }
-
-// TestGetMachines tests '/v2/admin/machines' sends back messages of all machines.
-func TestGetMachines(t *testing.T) {
-	_, etcds, err := CreateCluster(3, &os.ProcAttr{Files: []*os.File{nil, os.Stdout, os.Stderr}}, false)
-	assert.NoError(t, err)
-	defer DestroyCluster(etcds)
-
-	time.Sleep(1 * time.Second)
-
-	resp, err := tests.Get("http://localhost:7001/v2/admin/machines")
-	if !assert.Equal(t, err, nil) {
-		t.FailNow()
-	}
-	assert.Equal(t, resp.StatusCode, 200)
-	assert.Equal(t, resp.Header.Get("Content-Type"), "application/json")
-	machines := make([]map[string]interface{}, 0)
-	b := tests.ReadBody(resp)
-	json.Unmarshal(b, &machines)
-	assert.Equal(t, len(machines), 3)
-	if machines[0]["state"] != "leader" && machines[1]["state"] != "leader" && machines[2]["state"] != "leader" {
-		t.Errorf("no leader in the cluster")
-	}
-}

+ 0 - 72
tests/functional/single_node_test.go

@@ -1,72 +0,0 @@
-package test
-
-import (
-	"os"
-	"testing"
-	"time"
-
-	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
-)
-
-// Create a single node and try to set value
-func TestSingleNode(t *testing.T) {
-	procAttr := new(os.ProcAttr)
-	procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
-	args := []string{"etcd", "-name=node1", "-f", "-data-dir=/tmp/node1"}
-
-	process, err := os.StartProcess(EtcdBinPath, args, procAttr)
-	if err != nil {
-		t.Fatal("start process failed:" + err.Error())
-		return
-	}
-	defer process.Kill()
-
-	time.Sleep(time.Second)
-
-	c := etcd.NewClient(nil)
-
-	c.SyncCluster()
-	// Test Set
-	result, err := c.Set("foo", "bar", 100)
-	node := result.Node
-
-	if err != nil || node.Key != "/foo" || node.Value != "bar" || node.TTL < 95 {
-		if err != nil {
-			t.Fatal("Set 1: ", err)
-		}
-
-		t.Fatalf("Set 1 failed with %s %s %v", node.Key, node.Value, node.TTL)
-	}
-
-	time.Sleep(time.Second)
-
-	result, err = c.Set("foo", "bar", 100)
-	node = result.Node
-
-	if err != nil || node.Key != "/foo" || node.Value != "bar" || node.TTL != 100 {
-		if err != nil {
-			t.Fatal("Set 2: ", err)
-		}
-		t.Fatalf("Set 2 failed with %s %s %v", node.Key, node.Value, node.TTL)
-	}
-
-	// Add a test-and-set test
-
-	// First, we'll test we can change the value if we get it write
-	result, err = c.CompareAndSwap("foo", "foobar", 100, "bar", 0)
-	node = result.Node
-
-	if err != nil || node.Key != "/foo" || node.Value != "foobar" || node.TTL != 100 {
-		if err != nil {
-			t.Fatal(err)
-		}
-		t.Fatalf("Set 3 failed with %s %s %v", node.Key, node.Value, node.TTL)
-	}
-
-	// Next, we'll make sure we can't set it without the correct prior value
-	_, err = c.CompareAndSwap("foo", "foofoo", 100, "bar", 0)
-
-	if err == nil {
-		t.Fatalf("Set 4 expecting error when setting key with incorrect previous value")
-	}
-}