|
|
@ -39,7 +39,7 @@ func TestNewStoreWithNamespaces(t *testing.T) {
|
|
|
|
testutil.AssertNil(t, err)
|
|
|
|
testutil.AssertNil(t, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can retrieve an existing value.
|
|
|
|
// TestStoreGetValue ensures that the store can retrieve an existing value.
|
|
|
|
func TestStoreGetValue(t *testing.T) {
|
|
|
|
func TestStoreGetValue(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -53,7 +53,7 @@ func TestStoreGetValue(t *testing.T) {
|
|
|
|
assert.Equal(t, *e.Node.Value, "bar")
|
|
|
|
assert.Equal(t, *e.Node.Value, "bar")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can retrieve a directory in sorted order.
|
|
|
|
// TestStoreGetSorted ensures that the store can retrieve a directory in sorted order.
|
|
|
|
func TestStoreGetSorted(t *testing.T) {
|
|
|
|
func TestStoreGetSorted(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -171,7 +171,7 @@ func TestSet(t *testing.T) {
|
|
|
|
assert.Equal(t, e.Node.ModifiedIndex, uint64(5))
|
|
|
|
assert.Equal(t, e.Node.ModifiedIndex, uint64(5))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can create a new key if it doesn't already exist.
|
|
|
|
// TestStoreCreateValue ensures that the store can create a new key if it doesn't already exist.
|
|
|
|
func TestStoreCreateValue(t *testing.T) {
|
|
|
|
func TestStoreCreateValue(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -205,7 +205,7 @@ func TestStoreCreateValue(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can create a new directory if it doesn't already exist.
|
|
|
|
// TestStoreCreateDirectory ensures that the store can create a new directory if it doesn't already exist.
|
|
|
|
func TestStoreCreateDirectory(t *testing.T) {
|
|
|
|
func TestStoreCreateDirectory(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -218,7 +218,7 @@ func TestStoreCreateDirectory(t *testing.T) {
|
|
|
|
testutil.AssertTrue(t, e.Node.Dir)
|
|
|
|
testutil.AssertTrue(t, e.Node.Dir)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store fails to create a key if it already exists.
|
|
|
|
// TestStoreCreateFailsIfExists ensure that the store fails to create a key if it already exists.
|
|
|
|
func TestStoreCreateFailsIfExists(t *testing.T) {
|
|
|
|
func TestStoreCreateFailsIfExists(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -235,7 +235,7 @@ func TestStoreCreateFailsIfExists(t *testing.T) {
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can update a key if it already exists.
|
|
|
|
// TestStoreUpdateValue ensures that the store can update a key if it already exists.
|
|
|
|
func TestStoreUpdateValue(t *testing.T) {
|
|
|
|
func TestStoreUpdateValue(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -284,7 +284,7 @@ func TestStoreUpdateValue(t *testing.T) {
|
|
|
|
assert.Equal(t, *e.Node.Value, "")
|
|
|
|
assert.Equal(t, *e.Node.Value, "")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store cannot update a directory.
|
|
|
|
// TestStoreUpdateFailsIfDirectory ensures that the store cannot update a directory.
|
|
|
|
func TestStoreUpdateFailsIfDirectory(t *testing.T) {
|
|
|
|
func TestStoreUpdateFailsIfDirectory(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -297,7 +297,7 @@ func TestStoreUpdateFailsIfDirectory(t *testing.T) {
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can delete a value.
|
|
|
|
// TestStoreDeleteValue ensures that the store can delete a value.
|
|
|
|
func TestStoreDeleteValue(t *testing.T) {
|
|
|
|
func TestStoreDeleteValue(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -313,7 +313,7 @@ func TestStoreDeleteValue(t *testing.T) {
|
|
|
|
assert.Equal(t, *e.PrevNode.Value, "bar")
|
|
|
|
assert.Equal(t, *e.PrevNode.Value, "bar")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can delete a directory if recursive is specified.
|
|
|
|
// TestStoreDeleteDirectory ensures that the store can delete a directory if recursive is specified.
|
|
|
|
func TestStoreDeleteDirectory(t *testing.T) {
|
|
|
|
func TestStoreDeleteDirectory(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -349,8 +349,8 @@ func TestStoreDeleteDirectory(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store cannot delete a directory if both of recursive
|
|
|
|
// TestStoreDeleteDirectoryFailsIfNonRecursiveAndDir ensures that the
|
|
|
|
// and dir are not specified.
|
|
|
|
// store cannot delete a directory if both of recursive and dir are not specified.
|
|
|
|
func TestStoreDeleteDirectoryFailsIfNonRecursiveAndDir(t *testing.T) {
|
|
|
|
func TestStoreDeleteDirectoryFailsIfNonRecursiveAndDir(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -450,7 +450,7 @@ func TestStoreCompareAndDeletePrevIndexFailsIfNotMatch(t *testing.T) {
|
|
|
|
assert.Equal(t, *e.Node.Value, "bar")
|
|
|
|
assert.Equal(t, *e.Node.Value, "bar")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store cannot delete a directory.
|
|
|
|
// TestStoreCompareAndDeleteDirectoryFail ensures that the store cannot delete a directory.
|
|
|
|
func TestStoreCompareAndDeleteDirectoryFail(t *testing.T) {
|
|
|
|
func TestStoreCompareAndDeleteDirectoryFail(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -461,7 +461,8 @@ func TestStoreCompareAndDeleteDirectoryFail(t *testing.T) {
|
|
|
|
assert.Equal(t, err.ErrorCode, v2error.EcodeNotFile)
|
|
|
|
assert.Equal(t, err.ErrorCode, v2error.EcodeNotFile)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can conditionally update a key if it has a previous value.
|
|
|
|
// TestStoreCompareAndSwapPrevValue ensures that the store can conditionally
|
|
|
|
|
|
|
|
// update a key if it has a previous value.
|
|
|
|
func TestStoreCompareAndSwapPrevValue(t *testing.T) {
|
|
|
|
func TestStoreCompareAndSwapPrevValue(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
|
|
|
|
|
|
|
@ -483,7 +484,8 @@ func TestStoreCompareAndSwapPrevValue(t *testing.T) {
|
|
|
|
assert.Equal(t, *e.Node.Value, "baz")
|
|
|
|
assert.Equal(t, *e.Node.Value, "baz")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store cannot conditionally update a key if it has the wrong previous value.
|
|
|
|
// TestStoreCompareAndSwapPrevValueFailsIfNotMatch ensure that the store cannot
|
|
|
|
|
|
|
|
// conditionally update a key if it has the wrong previous value.
|
|
|
|
func TestStoreCompareAndSwapPrevValueFailsIfNotMatch(t *testing.T) {
|
|
|
|
func TestStoreCompareAndSwapPrevValueFailsIfNotMatch(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 1
|
|
|
|
var eidx uint64 = 1
|
|
|
@ -498,7 +500,8 @@ func TestStoreCompareAndSwapPrevValueFailsIfNotMatch(t *testing.T) {
|
|
|
|
assert.Equal(t, e.EtcdIndex, eidx)
|
|
|
|
assert.Equal(t, e.EtcdIndex, eidx)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can conditionally update a key if it has a previous index.
|
|
|
|
// TestStoreCompareAndSwapPrevIndex ensures that the store can conditionally
|
|
|
|
|
|
|
|
// update a key if it has a previous index.
|
|
|
|
func TestStoreCompareAndSwapPrevIndex(t *testing.T) {
|
|
|
|
func TestStoreCompareAndSwapPrevIndex(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 2
|
|
|
|
var eidx uint64 = 2
|
|
|
@ -520,7 +523,8 @@ func TestStoreCompareAndSwapPrevIndex(t *testing.T) {
|
|
|
|
assert.Equal(t, e.EtcdIndex, eidx)
|
|
|
|
assert.Equal(t, e.EtcdIndex, eidx)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store cannot conditionally update a key if it has the wrong previous index.
|
|
|
|
// TestStoreCompareAndSwapPrevIndexFailsIfNotMatch ensures that the store cannot
|
|
|
|
|
|
|
|
// conditionally update a key if it has the wrong previous index.
|
|
|
|
func TestStoreCompareAndSwapPrevIndexFailsIfNotMatch(t *testing.T) {
|
|
|
|
func TestStoreCompareAndSwapPrevIndexFailsIfNotMatch(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 1
|
|
|
|
var eidx uint64 = 1
|
|
|
@ -535,7 +539,7 @@ func TestStoreCompareAndSwapPrevIndexFailsIfNotMatch(t *testing.T) {
|
|
|
|
assert.Equal(t, *e.Node.Value, "bar")
|
|
|
|
assert.Equal(t, *e.Node.Value, "bar")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can watch for key creation.
|
|
|
|
// TestStoreWatchCreate ensures that the store can watch for key creation.
|
|
|
|
func TestStoreWatchCreate(t *testing.T) {
|
|
|
|
func TestStoreWatchCreate(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 0
|
|
|
|
var eidx uint64 = 0
|
|
|
@ -555,7 +559,8 @@ func TestStoreWatchCreate(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can watch for recursive key creation.
|
|
|
|
// TestStoreWatchRecursiveCreate ensures that the store
|
|
|
|
|
|
|
|
// can watch for recursive key creation.
|
|
|
|
func TestStoreWatchRecursiveCreate(t *testing.T) {
|
|
|
|
func TestStoreWatchRecursiveCreate(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 0
|
|
|
|
var eidx uint64 = 0
|
|
|
@ -570,7 +575,7 @@ func TestStoreWatchRecursiveCreate(t *testing.T) {
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo/bar")
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo/bar")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can watch for key updates.
|
|
|
|
// TestStoreWatchUpdate ensures that the store can watch for key updates.
|
|
|
|
func TestStoreWatchUpdate(t *testing.T) {
|
|
|
|
func TestStoreWatchUpdate(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 1
|
|
|
|
var eidx uint64 = 1
|
|
|
@ -585,7 +590,7 @@ func TestStoreWatchUpdate(t *testing.T) {
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo")
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can watch for recursive key updates.
|
|
|
|
// TestStoreWatchRecursiveUpdate ensures that the store can watch for recursive key updates.
|
|
|
|
func TestStoreWatchRecursiveUpdate(t *testing.T) {
|
|
|
|
func TestStoreWatchRecursiveUpdate(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 1
|
|
|
|
var eidx uint64 = 1
|
|
|
@ -601,7 +606,7 @@ func TestStoreWatchRecursiveUpdate(t *testing.T) {
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo/bar")
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo/bar")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can watch for key deletions.
|
|
|
|
// TestStoreWatchDelete ensures that the store can watch for key deletions.
|
|
|
|
func TestStoreWatchDelete(t *testing.T) {
|
|
|
|
func TestStoreWatchDelete(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 1
|
|
|
|
var eidx uint64 = 1
|
|
|
@ -616,7 +621,7 @@ func TestStoreWatchDelete(t *testing.T) {
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo")
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can watch for recursive key deletions.
|
|
|
|
// TestStoreWatchRecursiveDelete ensures that the store can watch for recursive key deletions.
|
|
|
|
func TestStoreWatchRecursiveDelete(t *testing.T) {
|
|
|
|
func TestStoreWatchRecursiveDelete(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 1
|
|
|
|
var eidx uint64 = 1
|
|
|
@ -632,7 +637,7 @@ func TestStoreWatchRecursiveDelete(t *testing.T) {
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo/bar")
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo/bar")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can watch for CAS updates.
|
|
|
|
// TestStoreWatchCompareAndSwap ensures that the store can watch for CAS updates.
|
|
|
|
func TestStoreWatchCompareAndSwap(t *testing.T) {
|
|
|
|
func TestStoreWatchCompareAndSwap(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 1
|
|
|
|
var eidx uint64 = 1
|
|
|
@ -647,7 +652,8 @@ func TestStoreWatchCompareAndSwap(t *testing.T) {
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo")
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can watch for recursive CAS updates.
|
|
|
|
// TestStoreWatchRecursiveCompareAndSwap ensures that the
|
|
|
|
|
|
|
|
// store can watch for recursive CAS updates.
|
|
|
|
func TestStoreWatchRecursiveCompareAndSwap(t *testing.T) {
|
|
|
|
func TestStoreWatchRecursiveCompareAndSwap(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 1
|
|
|
|
var eidx uint64 = 1
|
|
|
@ -662,7 +668,7 @@ func TestStoreWatchRecursiveCompareAndSwap(t *testing.T) {
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo/bar")
|
|
|
|
assert.Equal(t, e.Node.Key, "/foo/bar")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can watch in streaming mode.
|
|
|
|
// TestStoreWatchStream ensures that the store can watch in streaming mode.
|
|
|
|
func TestStoreWatchStream(t *testing.T) {
|
|
|
|
func TestStoreWatchStream(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 1
|
|
|
|
var eidx uint64 = 1
|
|
|
@ -694,7 +700,8 @@ func TestStoreWatchStream(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can watch for hidden keys as long as it's an exact path match.
|
|
|
|
// TestStoreWatchCreateWithHiddenKey ensure that the store can
|
|
|
|
|
|
|
|
// watch for hidden keys as long as it's an exact path match.
|
|
|
|
func TestStoreWatchCreateWithHiddenKey(t *testing.T) {
|
|
|
|
func TestStoreWatchCreateWithHiddenKey(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 1
|
|
|
|
var eidx uint64 = 1
|
|
|
@ -711,7 +718,8 @@ func TestStoreWatchCreateWithHiddenKey(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store doesn't see hidden key creates without an exact path match in recursive mode.
|
|
|
|
// TestStoreWatchRecursiveCreateWithHiddenKey ensures that the store doesn't
|
|
|
|
|
|
|
|
// see hidden key creates without an exact path match in recursive mode.
|
|
|
|
func TestStoreWatchRecursiveCreateWithHiddenKey(t *testing.T) {
|
|
|
|
func TestStoreWatchRecursiveCreateWithHiddenKey(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
w, _ := s.Watch("/foo", true, false, 0)
|
|
|
|
w, _ := s.Watch("/foo", true, false, 0)
|
|
|
@ -733,7 +741,8 @@ func TestStoreWatchRecursiveCreateWithHiddenKey(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store doesn't see hidden key updates.
|
|
|
|
// TestStoreWatchUpdateWithHiddenKey ensures that the store
|
|
|
|
|
|
|
|
// doesn't see hidden key updates.
|
|
|
|
func TestStoreWatchUpdateWithHiddenKey(t *testing.T) {
|
|
|
|
func TestStoreWatchUpdateWithHiddenKey(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
s.Create("/_foo", false, "bar", false, v2store.TTLOptionSet{ExpireTime: v2store.Permanent})
|
|
|
|
s.Create("/_foo", false, "bar", false, v2store.TTLOptionSet{ExpireTime: v2store.Permanent})
|
|
|
@ -746,7 +755,8 @@ func TestStoreWatchUpdateWithHiddenKey(t *testing.T) {
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store doesn't see hidden key updates without an exact path match in recursive mode.
|
|
|
|
// TestStoreWatchRecursiveUpdateWithHiddenKey ensures that the store doesn't
|
|
|
|
|
|
|
|
// see hidden key updates without an exact path match in recursive mode.
|
|
|
|
func TestStoreWatchRecursiveUpdateWithHiddenKey(t *testing.T) {
|
|
|
|
func TestStoreWatchRecursiveUpdateWithHiddenKey(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
s.Create("/foo/_bar", false, "baz", false, v2store.TTLOptionSet{ExpireTime: v2store.Permanent})
|
|
|
|
s.Create("/foo/_bar", false, "baz", false, v2store.TTLOptionSet{ExpireTime: v2store.Permanent})
|
|
|
@ -756,7 +766,7 @@ func TestStoreWatchRecursiveUpdateWithHiddenKey(t *testing.T) {
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store can watch for key deletions.
|
|
|
|
// TestStoreWatchDeleteWithHiddenKey ensures that the store can watch for key deletions.
|
|
|
|
func TestStoreWatchDeleteWithHiddenKey(t *testing.T) {
|
|
|
|
func TestStoreWatchDeleteWithHiddenKey(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 2
|
|
|
|
var eidx uint64 = 2
|
|
|
@ -771,7 +781,8 @@ func TestStoreWatchDeleteWithHiddenKey(t *testing.T) {
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store doesn't see hidden key deletes without an exact path match in recursive mode.
|
|
|
|
// TestStoreWatchRecursiveDeleteWithHiddenKey ensures that the store doesn't see
|
|
|
|
|
|
|
|
// hidden key deletes without an exact path match in recursive mode.
|
|
|
|
func TestStoreWatchRecursiveDeleteWithHiddenKey(t *testing.T) {
|
|
|
|
func TestStoreWatchRecursiveDeleteWithHiddenKey(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
s.Create("/foo/_bar", false, "baz", false, v2store.TTLOptionSet{ExpireTime: v2store.Permanent})
|
|
|
|
s.Create("/foo/_bar", false, "baz", false, v2store.TTLOptionSet{ExpireTime: v2store.Permanent})
|
|
|
@ -781,7 +792,8 @@ func TestStoreWatchRecursiveDeleteWithHiddenKey(t *testing.T) {
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
testutil.AssertNil(t, e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that the store does see hidden key creates if watching deeper than a hidden key in recursive mode.
|
|
|
|
// TestStoreWatchRecursiveCreateDeeperThanHiddenKey ensures that the store does see
|
|
|
|
|
|
|
|
// hidden key creates if watching deeper than a hidden key in recursive mode.
|
|
|
|
func TestStoreWatchRecursiveCreateDeeperThanHiddenKey(t *testing.T) {
|
|
|
|
func TestStoreWatchRecursiveCreateDeeperThanHiddenKey(t *testing.T) {
|
|
|
|
s := v2store.New()
|
|
|
|
s := v2store.New()
|
|
|
|
var eidx uint64 = 1
|
|
|
|
var eidx uint64 = 1
|
|
|
@ -795,7 +807,7 @@ func TestStoreWatchRecursiveCreateDeeperThanHiddenKey(t *testing.T) {
|
|
|
|
assert.Equal(t, e.Node.Key, "/_foo/bar/baz")
|
|
|
|
assert.Equal(t, e.Node.Key, "/_foo/bar/baz")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure that slow consumers are handled properly.
|
|
|
|
// TestStoreWatchSlowConsumer ensures that slow consumers are handled properly.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Since Watcher.EventChan() has a buffer of size 100 we can only queue 100
|
|
|
|
// Since Watcher.EventChan() has a buffer of size 100 we can only queue 100
|
|
|
|
// event per watcher. If the consumer cannot consume the event on time and
|
|
|
|
// event per watcher. If the consumer cannot consume the event on time and
|
|
|
|