mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Update migration.
This commit is contained in:
@@ -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, "")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user