Merge pull request #292 from xiangli-cmu/fix-ttl

WIP: fix ttl
This commit is contained in:
Xiang Li
2013-11-11 21:30:32 -08:00
40 changed files with 728 additions and 506 deletions

View File

@@ -65,8 +65,7 @@ func TestMultiNodeKillAllAndRecovery(t *testing.T) {
t.Fatalf("Recovery error: %s", err)
}
if result.Index != 18 {
t.Fatalf("recovery failed! [%d/18]", result.Index)
if result.Index != 16 {
t.Fatalf("recovery failed! [%d/16]", result.Index)
}
}

View File

@@ -1,6 +1,7 @@
package test
import (
"fmt"
"net/http"
"os"
"testing"
@@ -31,6 +32,7 @@ func TestRemoveNode(t *testing.T) {
for i := 0; i < 2; i++ {
client.Do(rmReq)
fmt.Println("send remove to node3 and wait for its exiting")
etcds[2].Wait()
resp, err := c.Get("_etcd/machines")
@@ -71,6 +73,7 @@ func TestRemoveNode(t *testing.T) {
// first kill the node, then remove it, then add it back
for i := 0; i < 2; i++ {
etcds[2].Kill()
fmt.Println("kill node3 and wait for its exiting")
etcds[2].Wait()
client.Do(rmReq)

View File

@@ -3,6 +3,7 @@ package test
import (
"io/ioutil"
"os"
"strconv"
"testing"
"time"
@@ -52,8 +53,10 @@ func TestSimpleSnapshot(t *testing.T) {
t.Fatal("wrong number of snapshot :[1/", len(snapshots), "]")
}
if snapshots[0].Name() != "0_503.ss" {
t.Fatal("wrong name of snapshot :[0_503.ss/", snapshots[0].Name(), "]")
index, _ := strconv.Atoi(snapshots[0].Name()[2:5])
if index < 507 || index > 510 {
t.Fatal("wrong name of snapshot :", snapshots[0].Name())
}
// issue second 501 commands
@@ -82,7 +85,9 @@ func TestSimpleSnapshot(t *testing.T) {
t.Fatal("wrong number of snapshot :[1/", len(snapshots), "]")
}
if snapshots[0].Name() != "0_1004.ss" {
t.Fatal("wrong name of snapshot :[0_1004.ss/", snapshots[0].Name(), "]")
index, _ = strconv.Atoi(snapshots[0].Name()[2:6])
if index < 1015 || index > 1018 {
t.Fatal("wrong name of snapshot :", snapshots[0].Name())
}
}