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:
parent
3d4e604607
commit
bf76af8fd1
2
tests/fixtures/v1/README
vendored
2
tests/fixtures/v1/README
vendored
@ -12,4 +12,4 @@ $ tests/fixtures/v1/complete.2.sh
|
|||||||
$ tests/fixtures/v1/complete.3.sh
|
$ tests/fixtures/v1/complete.3.sh
|
||||||
$ tests/fixtures/v1/complete.4.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*.
|
||||||
|
1
tests/fixtures/v1/complete/conf
vendored
1
tests/fixtures/v1/complete/conf
vendored
@ -1 +0,0 @@
|
|||||||
{"commitIndex":16,"peers":[{"name":"node3","connectionString":""}]}
|
|
18
tests/fixtures/v1/complete/info
vendored
18
tests/fixtures/v1/complete/info
vendored
@ -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": ""
|
|
||||||
}
|
|
||||||
}
|
|
BIN
tests/fixtures/v1/complete/log
vendored
BIN
tests/fixtures/v1/complete/log
vendored
Binary file not shown.
@ -5,6 +5,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -18,22 +19,29 @@ func TestV1Migration(t *testing.T) {
|
|||||||
os.RemoveAll(path)
|
os.RemoveAll(path)
|
||||||
defer os.RemoveAll(path)
|
defer os.RemoveAll(path)
|
||||||
|
|
||||||
// Copy over fixture files.
|
nodes := []string{"node0", "node1"}
|
||||||
if err := exec.Command("cp", "-r", "../fixtures/v1/complete", path).Run(); err != nil {
|
for i, node := range nodes {
|
||||||
panic("Fixture initialization error")
|
nodepath := filepath.Join(path, node)
|
||||||
}
|
|
||||||
|
|
||||||
procAttr := new(os.ProcAttr)
|
// Copy over fixture files.
|
||||||
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
|
if err := exec.Command("cp", "-r", "../fixtures/v1/" + node, nodepath).Run(); err != nil {
|
||||||
args := []string{"etcd", fmt.Sprintf("-d=%s", path)}
|
panic("Fixture initialization error")
|
||||||
|
}
|
||||||
|
|
||||||
process, err := os.StartProcess(EtcdBinPath, args, procAttr)
|
procAttr := new(os.ProcAttr)
|
||||||
if err != nil {
|
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
|
||||||
t.Fatal("start process failed:" + err.Error())
|
|
||||||
return
|
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.
|
// Ensure deleted message is removed.
|
||||||
@ -48,4 +56,3 @@ func TestV1Migration(t *testing.T) {
|
|||||||
assert.Nil(t, err, "")
|
assert.Nil(t, err, "")
|
||||||
assert.Equal(t, resp.StatusCode, 404, "")
|
assert.Equal(t, resp.StatusCode, 404, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user