Browse Source

tools/functional-tester: minor cleanup

Gyu-Ho Lee 10 years ago
parent
commit
ed682c9f08

+ 9 - 3
tools/functional-tester/etcd-agent/agent_test.go

@@ -23,20 +23,24 @@ import (
 const etcdPath = "./etcd"
 
 func TestAgentStart(t *testing.T) {
+	defer os.Remove("etcd.log")
+
 	a, dir := newTestAgent(t)
 	defer a.terminate()
 
-	err := a.start("-data-dir", dir)
+	err := a.start("--data-dir", dir)
 	if err != nil {
 		t.Fatal(err)
 	}
 }
 
 func TestAgentRestart(t *testing.T) {
+	defer os.Remove("etcd.log")
+
 	a, dir := newTestAgent(t)
 	defer a.terminate()
 
-	err := a.start("-data-dir", dir)
+	err := a.start("--data-dir", dir)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -52,9 +56,11 @@ func TestAgentRestart(t *testing.T) {
 }
 
 func TestAgentTerminate(t *testing.T) {
+	defer os.Remove("etcd.log")
+
 	a, dir := newTestAgent(t)
 
-	err := a.start("-data-dir", dir)
+	err := a.start("--data-dir", dir)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 1 - 0
tools/functional-tester/etcd-agent/rpc.go

@@ -30,6 +30,7 @@ func (a *Agent) serveRPC() {
 	if e != nil {
 		log.Fatal("agent:", e)
 	}
+	log.Println("agent listening on :9027")
 	go http.Serve(l, nil)
 }
 

+ 4 - 4
tools/functional-tester/etcd-agent/rpc_test.go

@@ -43,7 +43,7 @@ func TestRPCStart(t *testing.T) {
 		t.Fatal(err)
 	}
 	var pid int
-	err = c.Call("Agent.RPCStart", []string{"-data-dir", dir}, &pid)
+	err = c.Call("Agent.RPCStart", []string{"--data-dir", dir}, &pid)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -66,7 +66,7 @@ func TestRPCRestart(t *testing.T) {
 		t.Fatal(err)
 	}
 	var pid int
-	err = c.Call("Agent.RPCStart", []string{"-data-dir", dir}, &pid)
+	err = c.Call("Agent.RPCStart", []string{"--data-dir", dir}, &pid)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -111,7 +111,7 @@ func TestRPCTerminate(t *testing.T) {
 		t.Fatal(err)
 	}
 	var pid int
-	err = c.Call("Agent.RPCStart", []string{"-data-dir", dir}, &pid)
+	err = c.Call("Agent.RPCStart", []string{"--data-dir", dir}, &pid)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -146,7 +146,7 @@ func TestRPCStatus(t *testing.T) {
 		t.Fatal(err)
 	}
 	var pid int
-	err = c.Call("Agent.RPCStart", []string{"-data-dir", dir}, &pid)
+	err = c.Call("Agent.RPCStart", []string{"--data-dir", dir}, &pid)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 4 - 4
tools/functional-tester/etcd-tester/cluster.go

@@ -23,7 +23,7 @@ import (
 	"time"
 
 	"github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
-	etcdclient "github.com/coreos/etcd/client"
+	clientv2 "github.com/coreos/etcd/client"
 	"github.com/coreos/etcd/tools/functional-tester/etcd-agent/client"
 )
 
@@ -198,15 +198,15 @@ func (c *cluster) Status() ClusterStatus {
 // setHealthKey sets health key on all given urls.
 func setHealthKey(us []string) error {
 	for _, u := range us {
-		cfg := etcdclient.Config{
+		cfg := clientv2.Config{
 			Endpoints: []string{u},
 		}
-		c, err := etcdclient.New(cfg)
+		c, err := clientv2.New(cfg)
 		if err != nil {
 			return err
 		}
 		ctx, cancel := context.WithTimeout(context.Background(), time.Second)
-		kapi := etcdclient.NewKeysAPI(c)
+		kapi := clientv2.NewKeysAPI(c)
 		_, err = kapi.Set(ctx, "health", "good", nil)
 		cancel()
 		if err != nil {