Merge pull request #1016 from hashicorp/b-broken-kv-test

Fixes a broken unit test introduced by #834.
This commit is contained in:
Ryan Uber 2015-06-09 12:10:16 -07:00
commit 23cb08222e
1 changed files with 8 additions and 8 deletions

View File

@ -24,21 +24,21 @@ func TestClientPutGetDelete(t *testing.T) {
t.Fatalf("unexpected value: %#v", pair) t.Fatalf("unexpected value: %#v", pair)
} }
// Put the key
value := []byte("test") value := []byte("test")
p := &KVPair{Key: key, Flags: 42, Value: value}
if _, err := kv.Put(p, nil); err != nil {
t.Fatalf("err: %v", err)
}
// Put a key that begins with a '/' // Put a key that begins with a '/', this should fail
invalidKey := "/test" invalidKey := "/test"
value = []byte(invalidKey) p := &KVPair{Key: invalidKey, Flags: 42, Value: value}
p = &KVPair{Key: key, Flags: 42, Value: value}
if _, err := kv.Put(p, nil); err == nil { if _, err := kv.Put(p, nil); err == nil {
t.Fatalf("Invalid key not detected: %s", invalidKey) t.Fatalf("Invalid key not detected: %s", invalidKey)
} }
// Put the key
p = &KVPair{Key: key, Flags: 42, Value: value}
if _, err := kv.Put(p, nil); err != nil {
t.Fatalf("err: %v", err)
}
// Get should work // Get should work
pair, meta, err := kv.Get(key, nil) pair, meta, err := kv.Get(key, nil)
if err != nil { if err != nil {