aboutsummaryrefslogtreecommitdiff
path: root/cmd/bolt/main_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2016-09-01 15:34:35 -0600
committerBen Johnson <benbjohnson@yahoo.com>2016-09-05 15:43:02 -0600
commitf5d275b53730adc5a0c988cf79d4fac84c0a3210 (patch)
tree3402b7e1d9ddcc83102b385181d52bbac81e70d0 /cmd/bolt/main_test.go
parentMerge branch 'compact-db' of https://github.com/vincent-petithory/bolt into v... (diff)
downloaddedo-f5d275b53730adc5a0c988cf79d4fac84c0a3210.tar.gz
dedo-f5d275b53730adc5a0c988cf79d4fac84c0a3210.tar.xz
Minor bolt compact revisions
Diffstat (limited to 'cmd/bolt/main_test.go')
-rw-r--r--cmd/bolt/main_test.go21
1 files changed, 6 insertions, 15 deletions
diff --git a/cmd/bolt/main_test.go b/cmd/bolt/main_test.go
index e8942a0..0a11ff3 100644
--- a/cmd/bolt/main_test.go
+++ b/cmd/bolt/main_test.go
@@ -209,6 +209,9 @@ func TestCompactCommand_Run(t *testing.T) {
if err != nil {
return err
}
+ if err := b.SetSequence(uint64(i)); err != nil {
+ return err
+ }
if err := fillBucket(b, append(k, '.')); err != nil {
return err
}
@@ -263,7 +266,7 @@ func TestCompactCommand_Run(t *testing.T) {
}
m := NewMain()
- if err := m.Run("compact", db.Path, dstdb.Path); err != nil {
+ if err := m.Run("compact", "-o", dstdb.Path, db.Path); err != nil {
t.Fatal(err)
}
@@ -336,22 +339,10 @@ func chkdb(path string) ([]byte, error) {
}
func walkBucket(parent *bolt.Bucket, k []byte, v []byte, w io.Writer) error {
- _, err := w.Write(k)
- if err != nil {
- return err
- }
- _, err = io.WriteString(w, ":")
- if err != nil {
- return err
- }
- _, err = w.Write(v)
- if err != nil {
- return err
- }
- _, err = fmt.Fprintln(w)
- if err != nil {
+ if _, err := fmt.Fprintf(w, "%d:%x=%x\n", parent.Sequence(), k, v); err != nil {
return err
}
+
// not a bucket, exit.
if v != nil {
return nil