From 6b5d6ecd8b21c61a19e18b618a3378ce2c47d3d4 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Mon, 4 Nov 2013 13:46:43 -0700 Subject: [PATCH] Cluster migration test. --- tests/fixtures/v1/node0/conf | 1 + tests/fixtures/v1/node0/info | 18 ++++++++++++++++++ tests/fixtures/v1/node0/log | Bin 0 -> 1540 bytes tests/fixtures/v1/node2/conf | 1 + tests/fixtures/v1/node2/info | 18 ++++++++++++++++++ tests/fixtures/v1/node2/log | Bin 0 -> 1540 bytes tests/fixtures/v1/node3/conf | 1 + tests/fixtures/v1/node3/info | 18 ++++++++++++++++++ tests/fixtures/v1/node3/log | Bin 0 -> 1540 bytes tests/functional/v1_migration_test.go | 13 ++++++++++--- 10 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 tests/fixtures/v1/node0/conf create mode 100644 tests/fixtures/v1/node0/info create mode 100644 tests/fixtures/v1/node0/log create mode 100644 tests/fixtures/v1/node2/conf create mode 100644 tests/fixtures/v1/node2/info create mode 100644 tests/fixtures/v1/node2/log create mode 100644 tests/fixtures/v1/node3/conf create mode 100644 tests/fixtures/v1/node3/info create mode 100644 tests/fixtures/v1/node3/log diff --git a/tests/fixtures/v1/node0/conf b/tests/fixtures/v1/node0/conf new file mode 100644 index 000000000..8f401dbe4 --- /dev/null +++ b/tests/fixtures/v1/node0/conf @@ -0,0 +1 @@ +{"commitIndex":15,"peers":[{"name":"node2","connectionString":""}]} \ No newline at end of file diff --git a/tests/fixtures/v1/node0/info b/tests/fixtures/v1/node0/info new file mode 100644 index 000000000..398c8e1e8 --- /dev/null +++ b/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": "" + } +} diff --git a/tests/fixtures/v1/node0/log b/tests/fixtures/v1/node0/log new file mode 100644 index 0000000000000000000000000000000000000000..de3e7075e9396556e207ce78f30e80d042202a7a GIT binary patch literal 1540 zcmbu9O>dh(5Qf{PADd0vBt7N+>CM`9wwTRz(!?up)P*$d{bGqSjSrmSF5} z3;PfJMOUU!mhl8I**wm!$hl+4GHqS!B1;HyGfN8?rj@BO^g~CY<8mm2NC>eLJ8?QQaYkPly0Q3yM9j%27}P|0#9S6Yn9~C0=XYadu1Q8mu#bEE?I!Tgd%zW>iG5VP z{sm|6Het_d?9#4!K*sut+-q_lQ7b~LYLd7fT_l$hl}Q4n|>Sr E08;vuA^-pY literal 0 HcmV?d00001 diff --git a/tests/fixtures/v1/node2/conf b/tests/fixtures/v1/node2/conf new file mode 100644 index 000000000..19d6a9c92 --- /dev/null +++ b/tests/fixtures/v1/node2/conf @@ -0,0 +1 @@ +{"commitIndex":15,"peers":[{"name":"node0","connectionString":""}]} \ No newline at end of file diff --git a/tests/fixtures/v1/node2/info b/tests/fixtures/v1/node2/info new file mode 100644 index 000000000..85114a5f8 --- /dev/null +++ b/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": "" + } +} diff --git a/tests/fixtures/v1/node2/log b/tests/fixtures/v1/node2/log new file mode 100644 index 0000000000000000000000000000000000000000..de3e7075e9396556e207ce78f30e80d042202a7a GIT binary patch literal 1540 zcmbu9O>dh(5Qf{PADd0vBt7N+>CM`9wwTRz(!?up)P*$d{bGqSjSrmSF5} z3;PfJMOUU!mhl8I**wm!$hl+4GHqS!B1;HyGfN8?rj@BO^g~CY<8mm2NC>eLJ8?QQaYkPly0Q3yM9j%27}P|0#9S6Yn9~C0=XYadu1Q8mu#bEE?I!Tgd%zW>iG5VP z{sm|6Het_d?9#4!K*sut+-q_lQ7b~LYLd7fT_l$hl}Q4n|>Sr E08;vuA^-pY literal 0 HcmV?d00001 diff --git a/tests/fixtures/v1/node3/conf b/tests/fixtures/v1/node3/conf new file mode 100644 index 000000000..d8a5840de --- /dev/null +++ b/tests/fixtures/v1/node3/conf @@ -0,0 +1 @@ +{"commitIndex":15,"peers":[{"name":"node0","connectionString":""},{"name":"node2","connectionString":""}]} \ No newline at end of file diff --git a/tests/fixtures/v1/node3/info b/tests/fixtures/v1/node3/info new file mode 100644 index 000000000..5e5cb3f3a --- /dev/null +++ b/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": "" + } +} diff --git a/tests/fixtures/v1/node3/log b/tests/fixtures/v1/node3/log new file mode 100644 index 0000000000000000000000000000000000000000..de3e7075e9396556e207ce78f30e80d042202a7a GIT binary patch literal 1540 zcmbu9O>dh(5Qf{PADd0vBt7N+>CM`9wwTRz(!?up)P*$d{bGqSjSrmSF5} z3;PfJMOUU!mhl8I**wm!$hl+4GHqS!B1;HyGfN8?rj@BO^g~CY<8mm2NC>eLJ8?QQaYkPly0Q3yM9j%27}P|0#9S6Yn9~C0=XYadu1Q8mu#bEE?I!Tgd%zW>iG5VP z{sm|6Het_d?9#4!K*sut+-q_lQ7b~LYLd7fT_l$hl}Q4n|>Sr E08;vuA^-pY literal 0 HcmV?d00001 diff --git a/tests/functional/v1_migration_test.go b/tests/functional/v1_migration_test.go index f5d76fee5..b4c9a07bc 100644 --- a/tests/functional/v1_migration_test.go +++ b/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")