|
@@ -141,7 +141,7 @@ func TestForceNewCluster(t *testing.T) {
|
|
|
cancel()
|
|
cancel()
|
|
|
// ensure create has been applied in this machine
|
|
// ensure create has been applied in this machine
|
|
|
ctx, cancel = context.WithTimeout(context.Background(), requestTimeout)
|
|
ctx, cancel = context.WithTimeout(context.Background(), requestTimeout)
|
|
|
- if _, err := kapi.Watcher("/foo", &client.WatcherOptions{AfterIndex: resp.Node.ModifiedIndex}).Next(ctx); err != nil {
|
|
|
|
|
|
|
+ if _, err := kapi.Watcher("/foo", &client.WatcherOptions{AfterIndex: resp.Node.ModifiedIndex - 1}).Next(ctx); err != nil {
|
|
|
t.Fatalf("unexpected watch error: %v", err)
|
|
t.Fatalf("unexpected watch error: %v", err)
|
|
|
}
|
|
}
|
|
|
cancel()
|
|
cancel()
|
|
@@ -162,7 +162,7 @@ func TestForceNewCluster(t *testing.T) {
|
|
|
kapi = client.NewKeysAPI(cc)
|
|
kapi = client.NewKeysAPI(cc)
|
|
|
// ensure force restart keep the old data, and new cluster can make progress
|
|
// ensure force restart keep the old data, and new cluster can make progress
|
|
|
ctx, cancel = context.WithTimeout(context.Background(), requestTimeout)
|
|
ctx, cancel = context.WithTimeout(context.Background(), requestTimeout)
|
|
|
- if _, err := kapi.Watcher("/foo", &client.WatcherOptions{AfterIndex: resp.Node.ModifiedIndex}).Next(ctx); err != nil {
|
|
|
|
|
|
|
+ if _, err := kapi.Watcher("/foo", &client.WatcherOptions{AfterIndex: resp.Node.ModifiedIndex - 1}).Next(ctx); err != nil {
|
|
|
t.Fatalf("unexpected watch error: %v", err)
|
|
t.Fatalf("unexpected watch error: %v", err)
|
|
|
}
|
|
}
|
|
|
cancel()
|
|
cancel()
|
|
@@ -188,7 +188,7 @@ func clusterMustProgress(t *testing.T, membs []*member) {
|
|
|
mcc := mustNewHTTPClient(t, []string{u})
|
|
mcc := mustNewHTTPClient(t, []string{u})
|
|
|
mkapi := client.NewKeysAPI(mcc)
|
|
mkapi := client.NewKeysAPI(mcc)
|
|
|
mctx, mcancel := context.WithTimeout(context.Background(), requestTimeout)
|
|
mctx, mcancel := context.WithTimeout(context.Background(), requestTimeout)
|
|
|
- if _, err := mkapi.Watcher(key, &client.WatcherOptions{AfterIndex: resp.Node.ModifiedIndex}).Next(mctx); err != nil {
|
|
|
|
|
|
|
+ if _, err := mkapi.Watcher(key, &client.WatcherOptions{AfterIndex: resp.Node.ModifiedIndex - 1}).Next(mctx); err != nil {
|
|
|
t.Fatalf("#%d: watch on %s error: %v", i, u, err)
|
|
t.Fatalf("#%d: watch on %s error: %v", i, u, err)
|
|
|
}
|
|
}
|
|
|
mcancel()
|
|
mcancel()
|