Skip to content

Commit adbf895

Browse files
committed
wag: test the iterator
Epic: none Release note: none
1 parent 7449883 commit adbf895

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/kv/kvserver/kvstorage/wag/store_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package wag
77

88
import (
9+
"context"
910
"fmt"
1011
"path/filepath"
1112
"strings"
@@ -39,6 +40,8 @@ func TestWrite(t *testing.T) {
3940
str, err := print.DecodeWriteBatch(b.Repr())
4041
require.NoError(t, err)
4142
out += fmt.Sprintf(">> %s\n%s", name, str)
43+
44+
require.NoError(t, b.Commit(false /* sync */))
4245
}
4346

4447
id := roachpb.FullReplicaID{RangeID: 123, ReplicaID: 4}
@@ -50,6 +53,15 @@ func TestWrite(t *testing.T) {
5053
// recursion. Remove it, and let the caller handle new lines.
5154
out = strings.ReplaceAll(out, "\n\n", "\n")
5255
echotest.Require(t, out, filepath.Join("testdata", t.Name()+".txt"))
56+
57+
// Smoke check that the iterator works.
58+
var iter Iterator
59+
count := 0
60+
for range iter.Iter(context.Background(), s.eng) {
61+
count++
62+
}
63+
require.NoError(t, iter.Error())
64+
require.Equal(t, 4, count)
5365
}
5466

5567
type store struct {

0 commit comments

Comments
 (0)