From bf76af8fd1ae74f16cfa055ee7328638da2c5bb7 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Mon, 4 Nov 2013 13:16:45 -0700 Subject: [PATCH] Update migration. --- tests/fixtures/v1/README | 2 +- tests/fixtures/v1/complete/conf | 1 - tests/fixtures/v1/complete/info | 18 --------- tests/fixtures/v1/complete/log | Bin 1643 -> 0 bytes tests/fixtures/v1/{complete.1.sh => run.1.sh} | 0 tests/fixtures/v1/{complete.2.sh => run.2.sh} | 0 tests/fixtures/v1/{complete.3.sh => run.3.sh} | 0 tests/fixtures/v1/{complete.4.sh => run.4.sh} | 0 tests/functional/v1_migration_test.go | 35 +++++++++++------- 9 files changed, 22 insertions(+), 34 deletions(-) delete mode 100644 tests/fixtures/v1/complete/conf delete mode 100644 tests/fixtures/v1/complete/info delete mode 100644 tests/fixtures/v1/complete/log rename tests/fixtures/v1/{complete.1.sh => run.1.sh} (100%) rename tests/fixtures/v1/{complete.2.sh => run.2.sh} (100%) rename tests/fixtures/v1/{complete.3.sh => run.3.sh} (100%) rename tests/fixtures/v1/{complete.4.sh => run.4.sh} (100%) diff --git a/tests/fixtures/v1/README b/tests/fixtures/v1/README index 8e24d1bc6..e930eda7d 100644 --- a/tests/fixtures/v1/README +++ b/tests/fixtures/v1/README @@ -12,4 +12,4 @@ $ tests/fixtures/v1/complete.2.sh $ tests/fixtures/v1/complete.3.sh $ tests/fixtures/v1/complete.4.sh -The resulting server state data can be found in tmp/node0. +The resulting server state data can be found in tmp/node*. diff --git a/tests/fixtures/v1/complete/conf b/tests/fixtures/v1/complete/conf deleted file mode 100644 index 2c5bb4e81..000000000 --- a/tests/fixtures/v1/complete/conf +++ /dev/null @@ -1 +0,0 @@ -{"commitIndex":16,"peers":[{"name":"node3","connectionString":""}]} \ No newline at end of file diff --git a/tests/fixtures/v1/complete/info b/tests/fixtures/v1/complete/info deleted file mode 100644 index 398c8e1e8..000000000 --- a/tests/fixtures/v1/complete/info +++ /dev/null @@ -1,18 +0,0 @@ -{ - "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/complete/log b/tests/fixtures/v1/complete/log deleted file mode 100644 index 72bda1d35f6abf4cca845fd6b57c9b997c901b41..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1643 zcmbuAO>dh(5Qh8R&8BVA9D72X3)y8^Fx+~GRH>DcG)}4>aacRFn6+Tzq_XSwj7JPIO*gX6rT*_u($r(_>k^VM0Zv4#TP&z64<_`UoK{4%cR diff --git a/tests/fixtures/v1/complete.1.sh b/tests/fixtures/v1/run.1.sh similarity index 100% rename from tests/fixtures/v1/complete.1.sh rename to tests/fixtures/v1/run.1.sh diff --git a/tests/fixtures/v1/complete.2.sh b/tests/fixtures/v1/run.2.sh similarity index 100% rename from tests/fixtures/v1/complete.2.sh rename to tests/fixtures/v1/run.2.sh diff --git a/tests/fixtures/v1/complete.3.sh b/tests/fixtures/v1/run.3.sh similarity index 100% rename from tests/fixtures/v1/complete.3.sh rename to tests/fixtures/v1/run.3.sh diff --git a/tests/fixtures/v1/complete.4.sh b/tests/fixtures/v1/run.4.sh similarity index 100% rename from tests/fixtures/v1/complete.4.sh rename to tests/fixtures/v1/run.4.sh diff --git a/tests/functional/v1_migration_test.go b/tests/functional/v1_migration_test.go index f6f892287..f5d76fee5 100644 --- a/tests/functional/v1_migration_test.go +++ b/tests/functional/v1_migration_test.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "os" "os/exec" + "path/filepath" "testing" "time" @@ -18,22 +19,29 @@ func TestV1Migration(t *testing.T) { os.RemoveAll(path) defer os.RemoveAll(path) - // Copy over fixture files. - if err := exec.Command("cp", "-r", "../fixtures/v1/complete", path).Run(); err != nil { - panic("Fixture initialization error") - } + nodes := []string{"node0", "node1"} + for i, node := range nodes { + nodepath := filepath.Join(path, node) - procAttr := new(os.ProcAttr) - procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr} - args := []string{"etcd", fmt.Sprintf("-d=%s", path)} + // Copy over fixture files. + if err := exec.Command("cp", "-r", "../fixtures/v1/" + node, nodepath).Run(); err != nil { + panic("Fixture initialization error") + } - process, err := os.StartProcess(EtcdBinPath, args, procAttr) - if err != nil { - t.Fatal("start process failed:" + err.Error()) - return + 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)) + process, err := os.StartProcess(EtcdBinPath, args, procAttr) + if err != nil { + t.Fatal("start process failed:" + err.Error()) + return + } + defer process.Kill() + time.Sleep(time.Second) } - defer process.Kill() - time.Sleep(time.Second) // Ensure deleted message is removed. @@ -48,4 +56,3 @@ func TestV1Migration(t *testing.T) { assert.Nil(t, err, "") assert.Equal(t, resp.StatusCode, 404, "") } -