@@ -21,6 +21,16 @@ var _ = Describe("ScanIterator", func() {
21
21
return err
22
22
}
23
23
24
+ var hashKey = "K_HASHTEST"
25
+ var hashSeed = func (n int ) error {
26
+ pipe := client .Pipeline ()
27
+ for i := 1 ; i <= n ; i ++ {
28
+ pipe .HSet (hashKey , fmt .Sprintf ("K%02d" , i ), "x" ).Err ()
29
+ }
30
+ _ , err := pipe .Exec ()
31
+ return err
32
+ }
33
+
24
34
BeforeEach (func () {
25
35
client = redis .NewClient (redisOptions ())
26
36
Expect (client .FlushDb ().Err ()).NotTo (HaveOccurred ())
@@ -62,6 +72,20 @@ var _ = Describe("ScanIterator", func() {
62
72
Expect (vals ).To (ContainElement ("K71" ))
63
73
})
64
74
75
+ It ("should hscan across multiple pages" , func () {
76
+ Expect (hashSeed (71 )).NotTo (HaveOccurred ())
77
+
78
+ var vals []string
79
+ iter := client .HScan (hashKey , 0 , "" , 10 ).Iterator ()
80
+ for iter .Next () {
81
+ vals = append (vals , iter .Val ())
82
+ }
83
+ Expect (iter .Err ()).NotTo (HaveOccurred ())
84
+ Expect (vals ).To (HaveLen (71 * 2 ))
85
+ Expect (vals ).To (ContainElement ("K01" ))
86
+ Expect (vals ).To (ContainElement ("K71" ))
87
+ })
88
+
65
89
It ("should scan to page borders" , func () {
66
90
Expect (seed (20 )).NotTo (HaveOccurred ())
67
91
0 commit comments