mirror of https://github.com/docker/docs.git
Move test subset calls to store_test.go
Signed-off-by: Alexandre Beslic <abronan@docker.com>
This commit is contained in:
parent
0a253a22bc
commit
2a885f0853
|
@ -28,15 +28,7 @@ func makeConsulClient(t *testing.T) Store {
|
|||
func TestConsulStore(t *testing.T) {
|
||||
kv := makeConsulClient(t)
|
||||
|
||||
testPutGetDelete(t, kv)
|
||||
testWatch(t, kv)
|
||||
testWatchTree(t, kv)
|
||||
testAtomicPut(t, kv)
|
||||
testAtomicDelete(t, kv)
|
||||
testLockUnlock(t, kv)
|
||||
testPutEphemeral(t, kv)
|
||||
testList(t, kv)
|
||||
testDeleteTree(t, kv)
|
||||
testStore(t, kv)
|
||||
}
|
||||
|
||||
func TestCreateEphemeralSession(t *testing.T) {
|
||||
|
|
|
@ -3,8 +3,6 @@ package store
|
|||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func makeEtcdClient(t *testing.T) Store {
|
||||
|
@ -28,34 +26,5 @@ func makeEtcdClient(t *testing.T) Store {
|
|||
func TestEtcdStore(t *testing.T) {
|
||||
kv := makeEtcdClient(t)
|
||||
|
||||
testPutGetDelete(t, kv)
|
||||
testWatch(t, kv)
|
||||
testWatchTree(t, kv)
|
||||
testAtomicPut(t, kv)
|
||||
testAtomicDelete(t, kv)
|
||||
testLockUnlock(t, kv)
|
||||
testPutEphemeral(t, kv)
|
||||
testList(t, kv)
|
||||
testDeleteTree(t, kv)
|
||||
}
|
||||
|
||||
func TestCreateDirectory(t *testing.T) {
|
||||
kv := makeEtcdClient(t)
|
||||
|
||||
etcd := kv.(*Etcd)
|
||||
|
||||
dir := "create/me/please"
|
||||
|
||||
// Create the directory
|
||||
err := etcd.createDirectory(normalize(dir))
|
||||
assert.NoError(t, err)
|
||||
|
||||
// The directory must exist
|
||||
pair, err := kv.Get(dir)
|
||||
assert.NoError(t, err)
|
||||
if assert.NotNil(t, pair) {
|
||||
assert.NotNil(t, pair.Value)
|
||||
}
|
||||
assert.Equal(t, pair.Value, []byte(""))
|
||||
assert.NotEqual(t, pair.LastIndex, 0)
|
||||
testStore(t, kv)
|
||||
}
|
||||
|
|
|
@ -7,6 +7,18 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func testStore(t *testing.T, kv Store) {
|
||||
testPutGetDelete(t, kv)
|
||||
testWatch(t, kv)
|
||||
testWatchTree(t, kv)
|
||||
testAtomicPut(t, kv)
|
||||
testAtomicDelete(t, kv)
|
||||
testLockUnlock(t, kv)
|
||||
testPutEphemeral(t, kv)
|
||||
testList(t, kv)
|
||||
testDeleteTree(t, kv)
|
||||
}
|
||||
|
||||
func testPutGetDelete(t *testing.T, kv Store) {
|
||||
key := "foo"
|
||||
value := []byte("bar")
|
||||
|
|
|
@ -3,8 +3,6 @@ package store
|
|||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func makeZkClient(t *testing.T) Store {
|
||||
|
@ -28,34 +26,5 @@ func makeZkClient(t *testing.T) Store {
|
|||
func TestZkStore(t *testing.T) {
|
||||
kv := makeZkClient(t)
|
||||
|
||||
testPutGetDelete(t, kv)
|
||||
testWatch(t, kv)
|
||||
testWatchTree(t, kv)
|
||||
testAtomicPut(t, kv)
|
||||
testAtomicDelete(t, kv)
|
||||
testLockUnlock(t, kv)
|
||||
testPutEphemeral(t, kv)
|
||||
testList(t, kv)
|
||||
testDeleteTree(t, kv)
|
||||
}
|
||||
|
||||
func TestCreateFullPath(t *testing.T) {
|
||||
kv := makeZkClient(t)
|
||||
|
||||
zk := kv.(*Zookeeper)
|
||||
|
||||
dir := "create/me/please"
|
||||
|
||||
// Create the directory
|
||||
err := zk.createFullpath([]string{"create", "me", "please"}, false)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// The directory must exist
|
||||
pair, err := kv.Get(dir)
|
||||
assert.NoError(t, err)
|
||||
if assert.NotNil(t, pair) {
|
||||
assert.NotNil(t, pair.Value)
|
||||
}
|
||||
assert.Equal(t, pair.Value, []byte{1})
|
||||
assert.NotEqual(t, pair.LastIndex, 0)
|
||||
testStore(t, kv)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue