adding etcd storage support for cluster meta data. Currently just

sequence. More to come...
This commit is contained in:
Chris Lu
2013-11-10 01:31:50 -08:00
parent 5cb6590eae
commit 1888d01fa0
12 changed files with 149 additions and 56 deletions

View File

@@ -14,13 +14,18 @@ func TestFileBacking(t *testing.T) {
verifySetGet(t, ms)
}
func TestEtcdBacking(t *testing.T) {
ms := &MetaStore{NewMetaStoreEtcdBacking("http://localhost:4001")}
verifySetGet(t, ms)
}
func verifySetGet(t *testing.T, ms *MetaStore) {
data := uint64(234234)
ms.SetUint64(data, "/tmp", "sequence")
if !ms.Has("/tmp", "sequence") {
ms.SetUint64("/tmp/sequence", data)
if !ms.Has("/tmp/sequence") {
t.Errorf("Failed to set data")
}
if val, err := ms.GetUint64("/tmp", "sequence"); err == nil {
if val, err := ms.GetUint64("/tmp/sequence"); err == nil {
if val != data {
t.Errorf("Set %d, but read back %d", data, val)
}