Browse Source

Cluster migration test.

Ben Johnson 12 years ago
parent
commit
6b5d6ecd8b

+ 1 - 0
tests/fixtures/v1/node0/conf

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

+ 18 - 0
tests/fixtures/v1/node0/info

@@ -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


+ 1 - 0
tests/fixtures/v1/node2/conf

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

+ 18 - 0
tests/fixtures/v1/node2/info

@@ -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


+ 1 - 0
tests/fixtures/v1/node3/conf

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

+ 18 - 0
tests/fixtures/v1/node3/info

@@ -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


+ 10 - 3
tests/functional/v1_migration_test.go

@@ -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")