Merge pull request #72 from philips/tests-do-not-listen-publicly

chore(*test.go): use 127.0.0.1
release-0.4
Xiang Li 2013-08-08 14:28:07 -07:00
commit 30c9b98310
3 changed files with 6 additions and 6 deletions

View File

@ -34,7 +34,7 @@ func TestKillLeader(t *testing.T) {
var totalTime time.Duration
leader := "0.0.0.0:7001"
leader := "127.0.0.1:7001"
for i := 0; i < 10; i++ {
port, _ := strconv.Atoi(strings.Split(leader, ":")[1])
@ -134,7 +134,7 @@ func BenchmarkEtcdDirectCall(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
resp, _ := http.Get("http://0.0.0.0:4001/test/speed")
resp, _ := http.Get("http://127.0.0.1:4001/test/speed")
resp.Body.Close()
}

View File

@ -14,7 +14,7 @@ import (
func TestSingleNode(t *testing.T) {
procAttr := new(os.ProcAttr)
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
args := []string{"etcd", "-f", "-d=/tmp/node1"}
args := []string{"etcd", "-h=127.0.0.1", "-f", "-d=/tmp/node1"}
process, err := os.StartProcess("etcd", args, procAttr)
if err != nil {
@ -56,7 +56,7 @@ func TestSingleNode(t *testing.T) {
func TestSingleNodeRecovery(t *testing.T) {
procAttr := new(os.ProcAttr)
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
args := []string{"etcd", "-d=/tmp/node1"}
args := []string{"etcd", "-h=127.0.0.1", "-d=/tmp/node1"}
process, err := os.StartProcess("etcd", append(args, "-f"), procAttr)
if err != nil {

View File

@ -59,10 +59,10 @@ func createCluster(size int, procAttr *os.ProcAttr) ([][]string, []*os.Process,
argGroup := make([][]string, size)
for i := 0; i < size; i++ {
if i == 0 {
argGroup[i] = []string{"etcd", "-d=/tmp/node1"}
argGroup[i] = []string{"etcd", "-h=127.0.0.1", "-d=/tmp/node1"}
} else {
strI := strconv.Itoa(i + 1)
argGroup[i] = []string{"etcd", "-c=400" + strI, "-s=700" + strI, "-d=/tmp/node" + strI, "-C=127.0.0.1:7001"}
argGroup[i] = []string{"etcd", "-h=127.0.0.1", "-c=400" + strI, "-s=700" + strI, "-d=/tmp/node" + strI, "-C=127.0.0.1:7001"}
}
}