Skip to content

Commit

Permalink
Add test case for KeyOnly being false
Browse files Browse the repository at this point in the history
  • Loading branch information
shafreeck committed Aug 30, 2018
1 parent 74b4413 commit d4e82a2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions store/tikv/scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,24 @@ func (s *testScanSuite) TestSeek(c *C) {
}
scan.Next()
c.Assert(scan.Valid(), IsFalse)

// Restore KeyOnly to false
txn3.SetOption(kv.KeyOnly, false)
scan, err = txn3.Seek(encodeKey(s.prefix, ""))
c.Assert(err, IsNil)

for i := 0; i < rowNum; i++ {
k := scan.Key()
c.Assert([]byte(k), BytesEquals, encodeKey(s.prefix, s08d("key", i)))
v := scan.Value()
c.Assert(v, BytesEquals, valueBytes(i))
// Because newScan return first item without calling scan.Next() just like go-hbase,
// for-loop count will decrease 1.
if i < rowNum-1 {
scan.Next()
}
}
scan.Next()
c.Assert(scan.Valid(), IsFalse)
}
}

0 comments on commit d4e82a2

Please sign in to comment.