Cluster migration test.

This commit is contained in:
Ben Johnson 2013-11-04 13:46:43 -07:00
parent bf76af8fd1
commit 6b5d6ecd8b
10 changed files with 67 additions and 3 deletions

1
tests/fixtures/v1/node0/conf vendored Normal file
View File

@ -0,0 +1 @@
{"commitIndex":15,"peers":[{"name":"node2","connectionString":""}]}

18
tests/fixtures/v1/node0/info vendored Normal file
View File

@ -0,0 +1,18 @@
{
"name": "node0",
"raftURL": "http://127.0.0.1:7001",
"etcdURL": "http://127.0.0.1:4001",
"webURL": "",
"raftListenHost": "127.0.0.1:7001",
"etcdListenHost": "127.0.0.1:4001",
"raftTLS": {
"CertFile": "",
"KeyFile": "",
"CAFile": ""
},
"etcdTLS": {
"CertFile": "",
"KeyFile": "",
"CAFile": ""
}
}

BIN
tests/fixtures/v1/node0/log vendored Normal file

Binary file not shown.

1
tests/fixtures/v1/node2/conf vendored Normal file
View File

@ -0,0 +1 @@
{"commitIndex":15,"peers":[{"name":"node0","connectionString":""}]}

18
tests/fixtures/v1/node2/info vendored Normal file
View File

@ -0,0 +1,18 @@
{
"name": "node2",
"raftURL": "http://127.0.0.1:7002",
"etcdURL": "http://127.0.0.1:4002",
"webURL": "",
"raftListenHost": "127.0.0.1:7002",
"etcdListenHost": "127.0.0.1:4002",
"raftTLS": {
"CertFile": "",
"KeyFile": "",
"CAFile": ""
},
"etcdTLS": {
"CertFile": "",
"KeyFile": "",
"CAFile": ""
}
}

BIN
tests/fixtures/v1/node2/log vendored Normal file

Binary file not shown.

1
tests/fixtures/v1/node3/conf vendored Normal file
View File

@ -0,0 +1 @@
{"commitIndex":15,"peers":[{"name":"node0","connectionString":""},{"name":"node2","connectionString":""}]}

18
tests/fixtures/v1/node3/info vendored Normal file
View File

@ -0,0 +1,18 @@
{
"name": "node3",
"raftURL": "http://127.0.0.1:7003",
"etcdURL": "http://127.0.0.1:4003",
"webURL": "",
"raftListenHost": "127.0.0.1:7003",
"etcdListenHost": "127.0.0.1:4003",
"raftTLS": {
"CertFile": "",
"KeyFile": "",
"CAFile": ""
},
"etcdTLS": {
"CertFile": "",
"KeyFile": "",
"CAFile": ""
}
}

BIN
tests/fixtures/v1/node3/log vendored Normal file

Binary file not shown.

View File

@ -19,13 +19,19 @@ func TestV1Migration(t *testing.T) {
os.RemoveAll(path)
defer os.RemoveAll(path)
nodes := []string{"node0", "node1"}
nodes := []string{"node0", "node2"}
for i, node := range nodes {
nodepath := filepath.Join(path, node)
fixturepath, _ := filepath.Abs(filepath.Join("../fixtures/v1/", node))
fmt.Println("FIXPATH =", fixturepath)
fmt.Println("NODEPATH =", nodepath)
os.MkdirAll(filepath.Dir(nodepath), 0777)
// Copy over fixture files.
if err := exec.Command("cp", "-r", "../fixtures/v1/" + node, nodepath).Run(); err != nil {
panic("Fixture initialization error")
c := exec.Command("cp", "-rf", fixturepath, nodepath)
if out, err := c.CombinedOutput(); err != nil {
fmt.Println(">>>>>>\n", string(out), "<<<<<<")
panic("Fixture initialization error:" + err.Error())
}
procAttr := new(os.ProcAttr)
@ -43,6 +49,7 @@ func TestV1Migration(t *testing.T) {
time.Sleep(time.Second)
}
time.Sleep(120 * time.Second)
// Ensure deleted message is removed.
resp, err := tests.Get("http://localhost:4001/v2/keys/message")