summaryrefslogtreecommitdiff
path: root/src/hub/src/spreadspace.org/sfive/s5store_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/hub/src/spreadspace.org/sfive/s5store_test.go')
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5store_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5store_test.go b/src/hub/src/spreadspace.org/sfive/s5store_test.go
index 2e69c89..46a959a 100644
--- a/src/hub/src/spreadspace.org/sfive/s5store_test.go
+++ b/src/hub/src/spreadspace.org/sfive/s5store_test.go
@@ -271,6 +271,29 @@ func TestOpen(t *testing.T) {
t.Fatalf("opening store with (some) buckets missing should throw an error")
}
+ // bolt db with missing index buckets
+ if db, err := bolt.Open(testBoltPath, 0600, &bolt.Options{Timeout: 100 * time.Millisecond}); err != nil {
+ t.Fatalf("unexpected error: %v", err)
+ } else {
+ err = db.Update(func(tx *bolt.Tx) error {
+ for _, bn := range storeBuckets {
+ if _, err := tx.CreateBucket([]byte(bn)); err != nil {
+ return err
+ }
+ }
+ return nil
+ })
+ if err != nil {
+ t.Fatalf("unexpected error: %v", err)
+ }
+ if err = db.Close(); err != nil {
+ t.Fatalf("unexpected error: %v", err)
+ }
+ }
+ if _, err := NewStore(StoreConfig{testBoltPath, false}); err == nil {
+ t.Fatalf("opening store with index buckets missing should throw an error")
+ }
+
// create new bolt-db and reopen it
os.Remove(testBoltPath)
store, err := NewStore(StoreConfig{testBoltPath, false})