Commit 3d627197 authored by Nick Craver's avatar Nick Craver

Tests: make profiling handle heartbeat

This is to ensure assumptions are correct. I believe what's happening if we're re-fetching the tie breaker key on a background interval which is landing in the profiler on the multiplexer. This likely the same symptom is affecting several tests. For example, LowAllocationEnumerable.

If this is correct, we should likely find a way to exclude the tie breaker (and any heartbeat activities) from the profiler...or give the profiler an option, but this would require changing the interface (bad) or we add info to a profiled command to indicate. Or we decide this is proper behavior (profiling everything) and we move the tests off DB 0 or something so we can easily exclude the tiebreaker GET.
parent 8d12e231
......@@ -93,7 +93,7 @@ public void ManyThreads()
conn.BeginProfiling(profiler.MyContext);
var threads = new List<Thread>();
const int CountPer = 100;
for (var i = 0; i < 16; i++)
{
var db = conn.GetDatabase(i);
......@@ -102,7 +102,7 @@ public void ManyThreads()
{
var threadTasks = new List<Task>();
for (var j = 0; j < 1000; j++)
for (var j = 0; j < CountPer; j++)
{
var task = db.StringSetAsync(prefix + j, "" + j);
threadTasks.Add(task);
......@@ -124,18 +124,18 @@ public void ManyThreads()
}
Assert.True(kinds.Count <= 2);
Assert.Contains("SET", kinds);
if (kinds.Count == 2 && !kinds.Contains("SELECT"))
if (kinds.Count == 2 && !kinds.Contains("SELECT") && !kinds.Contains("GET"))
{
Assert.True(false, "Non-SET, Non-SELECT command seen");
Assert.True(false, "Non-SET, Non-SELECT, Non-GET command seen");
}
Assert.Equal(16 * 1000, allVals.Count());
Assert.Equal(16 * CountPer, allVals.Count(cmd => cmd.Command == "SET"));
Assert.Equal(16, allVals.Select(cmd => cmd.Db).Distinct().Count());
for (var i = 0; i < 16; i++)
{
var setsInDb = allVals.Count(cmd => cmd.Db == i && cmd.Command == "SET");
Assert.Equal(1000, setsInDb);
Assert.Equal(CountPer, setsInDb);
}
}
}
......
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