mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
functional-tester: don't specify data dir on tester side
Data directory is added automatially in commit 2e3d27e but test was not updated.
This commit is contained in:
parent
e1e236155c
commit
f8e63934b1
@ -15,7 +15,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
@ -27,10 +26,10 @@ var etcdPath = filepath.Join(os.Getenv("GOPATH"), "bin/etcd")
|
||||
func TestAgentStart(t *testing.T) {
|
||||
defer os.Remove("etcd.log")
|
||||
|
||||
a, dir := newTestAgent(t)
|
||||
a := newTestAgent(t)
|
||||
defer a.terminate()
|
||||
|
||||
err := a.start("--data-dir", dir)
|
||||
err := a.start()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -39,10 +38,10 @@ func TestAgentStart(t *testing.T) {
|
||||
func TestAgentRestart(t *testing.T) {
|
||||
defer os.Remove("etcd.log")
|
||||
|
||||
a, dir := newTestAgent(t)
|
||||
a := newTestAgent(t)
|
||||
defer a.terminate()
|
||||
|
||||
err := a.start("--data-dir", dir)
|
||||
err := a.start()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -60,9 +59,9 @@ func TestAgentRestart(t *testing.T) {
|
||||
func TestAgentTerminate(t *testing.T) {
|
||||
defer os.Remove("etcd.log")
|
||||
|
||||
a, dir := newTestAgent(t)
|
||||
a := newTestAgent(t)
|
||||
|
||||
err := a.start("--data-dir", dir)
|
||||
err := a.start()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -72,21 +71,17 @@ func TestAgentTerminate(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if _, err := os.Stat(dir); !os.IsNotExist(err) {
|
||||
if _, err := os.Stat(a.dataDir()); !os.IsNotExist(err) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// newTestAgent creates a test agent and with a temp data directory.
|
||||
func newTestAgent(t *testing.T) (*Agent, string) {
|
||||
// newTestAgent creates a test agent
|
||||
func newTestAgent(t *testing.T) *Agent {
|
||||
a, err := newAgent(AgentConfig{EtcdPath: etcdPath, LogDir: "etcd.log"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
dir, err := ioutil.TempDir(os.TempDir(), "etcd-agent")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return a, dir
|
||||
return a
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user