e2e: put etcd datadir in golang tempdir

The command "TMPDIR=/mnt/myramdisk/etcd go test -v" was making data
directories in pwd instead of the tmpdir.
release-2.3
Anthony Romano 2016-03-09 22:03:40 -08:00
parent a243f80c80
commit 4a6c06db13
1 changed files with 9 additions and 2 deletions

View File

@ -16,6 +16,7 @@ package e2e
import ( import (
"fmt" "fmt"
"io/ioutil"
"math/rand" "math/rand"
"net/url" "net/url"
"os" "os"
@ -259,7 +260,10 @@ func (cfg *etcdProcessClusterConfig) etcdProcessConfigs() []*etcdProcessConfig {
curl := url.URL{Scheme: clientScheme, Host: fmt.Sprintf("localhost:%d", port)} curl := url.URL{Scheme: clientScheme, Host: fmt.Sprintf("localhost:%d", port)}
purl := url.URL{Scheme: peerScheme, Host: fmt.Sprintf("localhost:%d", port+1)} purl := url.URL{Scheme: peerScheme, Host: fmt.Sprintf("localhost:%d", port+1)}
name := fmt.Sprintf("testname%d", i) name := fmt.Sprintf("testname%d", i)
dataDirPath := name + ".etcd" dataDirPath, derr := ioutil.TempDir("", name+".etcd")
if derr != nil {
panic("could not get tempdir for datadir")
}
initialCluster[i] = fmt.Sprintf("%s=%s", name, purl.String()) initialCluster[i] = fmt.Sprintf("%s=%s", name, purl.String())
args := []string{ args := []string{
@ -284,7 +288,10 @@ func (cfg *etcdProcessClusterConfig) etcdProcessConfigs() []*etcdProcessConfig {
port := etcdProcessBasePort + 2*cfg.clusterSize + i + 1 port := etcdProcessBasePort + 2*cfg.clusterSize + i + 1
curl := url.URL{Scheme: clientScheme, Host: fmt.Sprintf("localhost:%d", port)} curl := url.URL{Scheme: clientScheme, Host: fmt.Sprintf("localhost:%d", port)}
name := fmt.Sprintf("testname-proxy%d", i) name := fmt.Sprintf("testname-proxy%d", i)
dataDirPath := name + ".etcd" dataDirPath, derr := ioutil.TempDir("", name+".etcd")
if derr != nil {
panic("could not get tempdir for datadir")
}
args := []string{ args := []string{
"--name", name, "--name", name,
"--proxy", "on", "--proxy", "on",