Commit 15d1d2f4 authored by Marc Gravell's avatar Marc Gravell

Test hscan/zscan/sscan against larger sets and with different page sizes

parent 3467ae34
......@@ -85,5 +85,68 @@ public void HashScan(bool supported)
Assert.IsTrue(arr.Any(x => x.Key == "c" && x.Value == "3"), "c");
}
}
[Test]
[TestCase(10)]
[TestCase(100)]
[TestCase(1000)]
[TestCase(10000)]
public void HashScanLarge(int pageSize)
{
using (var conn = Create())
{
RedisKey key = Me();
var db = conn.GetDatabase();
db.KeyDelete(key);
for(int i = 0; i < 2000;i++)
db.HashSet(key, "k" + i, "v" + i, flags: CommandFlags.FireAndForget);
int count = db.HashScan(key, pageSize: pageSize).Count();
Assert.AreEqual(2000, count);
}
}
[Test]
[TestCase(10)]
[TestCase(100)]
[TestCase(1000)]
[TestCase(10000)]
public void SetScanLarge(int pageSize)
{
using (var conn = Create())
{
RedisKey key = Me();
var db = conn.GetDatabase();
db.KeyDelete(key);
for (int i = 0; i < 2000; i++)
db.SetAdd(key, "s" + i, flags: CommandFlags.FireAndForget);
int count = db.SetScan(key, pageSize: pageSize).Count();
Assert.AreEqual(2000, count);
}
}
[Test]
[TestCase(10)]
[TestCase(100)]
[TestCase(1000)]
[TestCase(10000)]
public void SortedSetScanLarge(int pageSize)
{
using (var conn = Create())
{
RedisKey key = Me();
var db = conn.GetDatabase();
db.KeyDelete(key);
for (int i = 0; i < 2000; i++)
db.SortedSetAdd(key, "z" + i, i, flags: CommandFlags.FireAndForget);
int count = db.SortedSetScan(key, pageSize: pageSize).Count();
Assert.AreEqual(2000, count);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment