Renamed configuration parameters.

This commit is contained in:
Ben Johnson
2013-11-14 22:58:47 -05:00
parent 3ce1132d5c
commit cba2611c68
35 changed files with 332 additions and 342 deletions

View File

@@ -31,7 +31,7 @@ func TestInternalVersion(t *testing.T) {
procAttr := new(os.ProcAttr)
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
args := []string{"etcd", "-n=node1", "-f", "-d=/tmp/node1", "-C=" + fakeURL.Host}
args := []string{"etcd", "-name=node1", "-force-config", "-data-dir=/tmp/node1", "-peers=" + fakeURL.Host}
process, err := os.StartProcess(EtcdBinPath, args, procAttr)
if err != nil {
@@ -53,4 +53,3 @@ func TestInternalVersion(t *testing.T) {
return
}
}

View File

@@ -55,9 +55,8 @@ func TestKillLeader(t *testing.T) {
totalTime += take
avgTime := totalTime / (time.Duration)(i+1)
fmt.Println("Total time:", totalTime, "; Avg time:", avgTime)
etcds[num], err = os.StartProcess(EtcdBinPath, argGroup[num], procAttr)
}
stop <- true
}

View File

@@ -8,8 +8,8 @@ import (
"time"
)
// TestKillRandom kills random machines in the cluster and
// restart them after all other machines agree on the same leader
// TestKillRandom kills random peers in the cluster and
// restart them after all other peers agree on the same leader
func TestKillRandom(t *testing.T) {
procAttr := new(os.ProcAttr)
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
@@ -73,4 +73,3 @@ func TestKillRandom(t *testing.T) {
stop <- true
}

View File

@@ -55,4 +55,3 @@ func TestMultiNodeKillOne(t *testing.T) {
stop <- true
<-stop
}

View File

@@ -42,7 +42,7 @@ func TestRemoveNode(t *testing.T) {
}
if len(resp) != 2 {
t.Fatal("cannot remove machine")
t.Fatal("cannot remove peer")
}
if i == 1 {
@@ -50,7 +50,7 @@ func TestRemoveNode(t *testing.T) {
etcds[2], err = os.StartProcess(EtcdBinPath, argGroup[2], procAttr)
} else {
// rejoin without log
etcds[2], err = os.StartProcess(EtcdBinPath, append(argGroup[2], "-f"), procAttr)
etcds[2], err = os.StartProcess(EtcdBinPath, append(argGroup[2], "-force-config"), procAttr)
}
if err != nil {
@@ -66,7 +66,7 @@ func TestRemoveNode(t *testing.T) {
}
if len(resp) != 3 {
t.Fatalf("add machine fails #1 (%d != 3)", len(resp))
t.Fatalf("add peer fails #1 (%d != 3)", len(resp))
}
}
@@ -85,7 +85,7 @@ func TestRemoveNode(t *testing.T) {
}
if len(resp) != 2 {
t.Fatal("cannot remove machine")
t.Fatal("cannot remove peer")
}
if i == 1 {
@@ -93,7 +93,7 @@ func TestRemoveNode(t *testing.T) {
etcds[2], err = os.StartProcess(EtcdBinPath, append(argGroup[2]), procAttr)
} else {
// rejoin without log
etcds[2], err = os.StartProcess(EtcdBinPath, append(argGroup[2], "-f"), procAttr)
etcds[2], err = os.StartProcess(EtcdBinPath, append(argGroup[2], "-force-config"), procAttr)
}
if err != nil {
@@ -109,7 +109,7 @@ func TestRemoveNode(t *testing.T) {
}
if len(resp) != 3 {
t.Fatalf("add machine fails #2 (%d != 3)", len(resp))
t.Fatalf("add peer fails #2 (%d != 3)", len(resp))
}
}
}

View File

@@ -14,9 +14,9 @@ import (
func TestSimpleSnapshot(t *testing.T) {
procAttr := new(os.ProcAttr)
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
args := []string{"etcd", "-n=node1", "-d=/tmp/node1", "-snapshot=true", "-snapshotCount=500"}
args := []string{"etcd", "-name=node1", "-data-dir=/tmp/node1", "-snapshot=true", "-snapshot-count=500"}
process, err := os.StartProcess(EtcdBinPath, append(args, "-f"), procAttr)
process, err := os.StartProcess(EtcdBinPath, append(args, "-force-config"), procAttr)
if err != nil {
t.Fatal("start process failed:" + err.Error())
}

View File

@@ -13,9 +13,9 @@ import (
func TestSingleNodeRecovery(t *testing.T) {
procAttr := new(os.ProcAttr)
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
args := []string{"etcd", "-n=node1", "-d=/tmp/node1"}
args := []string{"etcd", "-name=node1", "-data-dir=/tmp/node1"}
process, err := os.StartProcess(EtcdBinPath, append(args, "-f"), procAttr)
process, err := os.StartProcess(EtcdBinPath, append(args, "-force-config"), procAttr)
if err != nil {
t.Fatal("start process failed:" + err.Error())
return
@@ -65,4 +65,3 @@ func TestSingleNodeRecovery(t *testing.T) {
t.Fatalf("Recovery Get failed with %s %s %v", result.Key, result.Value, result.TTL)
}
}

View File

@@ -12,7 +12,7 @@ import (
func TestSingleNode(t *testing.T) {
procAttr := new(os.ProcAttr)
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
args := []string{"etcd", "-n=node1", "-f", "-d=/tmp/node1"}
args := []string{"etcd", "-name=node1", "-force-config", "-data-dir=/tmp/node1"}
process, err := os.StartProcess(EtcdBinPath, args, procAttr)
if err != nil {
@@ -74,4 +74,3 @@ func TestSingleNode(t *testing.T) {
t.Fatalf("Set 5 expecting error when setting key with blank (incorrect) previous value")
}
}

View File

@@ -73,25 +73,25 @@ func Set(stop chan bool) {
func CreateCluster(size int, procAttr *os.ProcAttr, ssl bool) ([][]string, []*os.Process, error) {
argGroup := make([][]string, size)
sslServer1 := []string{"-serverCAFile=../../fixtures/ca/ca.crt",
"-serverCert=../../fixtures/ca/server.crt",
"-serverKey=../../fixtures/ca/server.key.insecure",
sslServer1 := []string{"-peer-ca-file=../../fixtures/ca/ca.crt",
"-peer-cert-file=../../fixtures/ca/server.crt",
"-peer-key-file=../../fixtures/ca/server.key.insecure",
}
sslServer2 := []string{"-serverCAFile=../../fixtures/ca/ca.crt",
"-serverCert=../../fixtures/ca/server2.crt",
"-serverKey=../../fixtures/ca/server2.key.insecure",
sslServer2 := []string{"-peer-ca-file=../../fixtures/ca/ca.crt",
"-peer-cert-file=../../fixtures/ca/server2.crt",
"-peer-cert-file=../../fixtures/ca/server2.key.insecure",
}
for i := 0; i < size; i++ {
if i == 0 {
argGroup[i] = []string{"etcd", "-d=/tmp/node1", "-n=node1"}
argGroup[i] = []string{"etcd", "-data-dir=/tmp/node1", "-name=node1"}
if ssl {
argGroup[i] = append(argGroup[i], sslServer1...)
}
} else {
strI := strconv.Itoa(i + 1)
argGroup[i] = []string{"etcd", "-n=node" + strI, "-c=127.0.0.1:400" + strI, "-s=127.0.0.1:700" + strI, "-d=/tmp/node" + strI, "-C=127.0.0.1:7001"}
argGroup[i] = []string{"etcd", "-name=node" + strI, "-addr=127.0.0.1:400" + strI, "-peer-addr=127.0.0.1:700" + strI, "-data-dir=/tmp/node" + strI, "-peers=127.0.0.1:7001"}
if ssl {
argGroup[i] = append(argGroup[i], sslServer2...)
}
@@ -102,7 +102,7 @@ func CreateCluster(size int, procAttr *os.ProcAttr, ssl bool) ([][]string, []*os
for i, _ := range etcds {
var err error
etcds[i], err = os.StartProcess(EtcdBinPath, append(argGroup[i], "-f"), procAttr)
etcds[i], err = os.StartProcess(EtcdBinPath, append(argGroup[i], "-force-config"), procAttr)
if err != nil {
return nil, nil, err
}

View File

@@ -33,9 +33,9 @@ func TestV1SoloMigration(t *testing.T) {
procAttr := new(os.ProcAttr)
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
args := []string{"etcd", fmt.Sprintf("-d=%s", nodepath)}
args = append(args, "-c", "127.0.0.1:4001")
args = append(args, "-s", "127.0.0.1:7001")
args := []string{"etcd", fmt.Sprintf("-data-dir=%s", nodepath)}
args = append(args, "-addr", "127.0.0.1:4001")
args = append(args, "-peer-addr", "127.0.0.1:7001")
process, err := os.StartProcess(EtcdBinPath, args, procAttr)
if err != nil {
t.Fatal("start process failed:" + err.Error())
@@ -75,9 +75,9 @@ func TestV1ClusterMigration(t *testing.T) {
procAttr := new(os.ProcAttr)
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
args := []string{"etcd", fmt.Sprintf("-d=%s", nodepath)}
args = append(args, "-c", fmt.Sprintf("127.0.0.1:%d", 4001 + i))
args = append(args, "-s", fmt.Sprintf("127.0.0.1:%d", 7001 + i))
args := []string{"etcd", fmt.Sprintf("-data-dir=%s", nodepath)}
args = append(args, "-addr", fmt.Sprintf("127.0.0.1:%d", 4001+i))
args = append(args, "-peer-addr", fmt.Sprintf("127.0.0.1:%d", 7001+i))
process, err := os.StartProcess(EtcdBinPath, args, procAttr)
if err != nil {
t.Fatal("start process failed:" + err.Error())
@@ -91,7 +91,7 @@ func TestV1ClusterMigration(t *testing.T) {
resp, err := tests.Get("http://localhost:4001/v2/keys/message")
body := tests.ReadBody(resp)
assert.Nil(t, err, "")
assert.Equal(t, resp.StatusCode, 400, )
assert.Equal(t, resp.StatusCode, 400)
assert.Equal(t, string(body), `{"errorCode":100,"message":"Key Not Found","cause":"/message","index":11}`+"\n")
// Ensure TTL'd message is removed.

View File

@@ -11,7 +11,7 @@ import (
func TestVersionCheck(t *testing.T) {
procAttr := new(os.ProcAttr)
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
args := []string{"etcd", "-n=node1", "-f", "-d=/tmp/version_check"}
args := []string{"etcd", "-name=node1", "-force-config", "-data-dir=/tmp/version_check"}
process, err := os.StartProcess(EtcdBinPath, args, procAttr)
if err != nil {
@@ -43,4 +43,3 @@ func TestVersionCheck(t *testing.T) {
t.Fatal("Invalid version check: ", resp.StatusCode)
}
}

View File

@@ -63,7 +63,6 @@ func DeleteForm(url string, data url.Values) (*http.Response, error) {
return Delete(url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
}
func send(method string, url string, bodyType string, body io.Reader) (*http.Response, error) {
c := NewHTTPClient()
req, err := http.NewRequest(method, url, body)

View File

@@ -2,7 +2,7 @@ package mock
import (
"net/http"
"github.com/coreos/etcd/store"
"github.com/coreos/go-raft"
"github.com/stretchr/testify/mock"

View File

@@ -10,10 +10,10 @@ import (
)
const (
testName = "ETCDTEST"
testClientURL = "localhost:4401"
testRaftURL = "localhost:7701"
testSnapCount = 10000
testName = "ETCDTEST"
testClientURL = "localhost:4401"
testRaftURL = "localhost:7701"
testSnapshotCount = 10000
)
// Starts a server in a temporary directory.
@@ -23,7 +23,7 @@ func RunServer(f func(*server.Server)) {
store := store.New()
registry := server.NewRegistry(store)
ps := server.NewPeerServer(testName, path, testRaftURL, testRaftURL, &server.TLSConfig{Scheme: "http"}, &server.TLSInfo{}, registry, store, testSnapCount)
ps := server.NewPeerServer(testName, path, testRaftURL, testRaftURL, &server.TLSConfig{Scheme: "http"}, &server.TLSInfo{}, registry, store, testSnapshotCount)
s := server.New(testName, testClientURL, testClientURL, &server.TLSConfig{Scheme: "http"}, &server.TLSInfo{}, ps, registry, store)
ps.SetServer(s)