From 4a6c06db136a418d0b398d9e569624fb4120a88c Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Wed, 9 Mar 2016 22:03:40 -0800 Subject: [PATCH] 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. --- e2e/etcd_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/e2e/etcd_test.go b/e2e/etcd_test.go index 2819e7e22..06dd777b0 100644 --- a/e2e/etcd_test.go +++ b/e2e/etcd_test.go @@ -16,6 +16,7 @@ package e2e import ( "fmt" + "io/ioutil" "math/rand" "net/url" "os" @@ -259,7 +260,10 @@ func (cfg *etcdProcessClusterConfig) etcdProcessConfigs() []*etcdProcessConfig { curl := url.URL{Scheme: clientScheme, Host: fmt.Sprintf("localhost:%d", port)} purl := url.URL{Scheme: peerScheme, Host: fmt.Sprintf("localhost:%d", port+1)} 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()) args := []string{ @@ -284,7 +288,10 @@ func (cfg *etcdProcessClusterConfig) etcdProcessConfigs() []*etcdProcessConfig { port := etcdProcessBasePort + 2*cfg.clusterSize + i + 1 curl := url.URL{Scheme: clientScheme, Host: fmt.Sprintf("localhost:%d", port)} 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{ "--name", name, "--proxy", "on",