Commit 965453e2 authored by Nick Craver's avatar Nick Craver

Fix and light up Cluster.MovedProfiling

This is no lonkger flaky...light the test up for Release as well.
parent b7f18015
...@@ -664,30 +664,28 @@ public void GroupedQueriesWork() ...@@ -664,30 +664,28 @@ public void GroupedQueriesWork()
var all = grouped.SelectMany(grp => { var all = grouped.SelectMany(grp => {
var grpKeys = grp.ToArray(); var grpKeys = grp.ToArray();
var values = db.StringGet(grpKeys); var values = db.StringGet(grpKeys);
return Enumerable.Zip(grpKeys, values, (key, val) => new { key, val }); return grpKeys.Zip(values, (key, val) => new { key, val });
}).ToDictionary(x => x.key, x => x.val); }).ToDictionary(x => x.key, x => x.val);
Assert.Equal(keys.Length, all.Count); Assert.Equal(keys.Length, all.Count);
} }
} }
#if DEBUG
[Fact] [Fact]
public void MovedProfiling() public void MovedProfiling()
{ {
const string Key = "redirected-key"; var Key = Me();
const string Value = "redirected-value"; const string Value = "redirected-value";
var profiler = new TestProfiler(); var profiler = new ProfilingSession();
using (var conn = Create()) using (var conn = Create())
{ {
conn.RegisterProfiler(profiler); conn.RegisterProfiler(() => profiler);
var endpoints = conn.GetEndPoints(); var endpoints = conn.GetEndPoints();
var servers = endpoints.Select(e => conn.GetServer(e)); var servers = endpoints.Select(e => conn.GetServer(e));
conn.BeginProfiling(profiler.MyContext);
var db = conn.GetDatabase(); var db = conn.GetDatabase();
db.KeyDelete(Key); db.KeyDelete(Key);
db.StringSet(Key, Value); db.StringSet(Key, Value);
...@@ -707,7 +705,7 @@ public void MovedProfiling() ...@@ -707,7 +705,7 @@ public void MovedProfiling()
string b = (string)conn.GetServer(wrongMasterNode.EndPoint).Execute("GET", Key); string b = (string)conn.GetServer(wrongMasterNode.EndPoint).Execute("GET", Key);
Assert.Equal(Value, b); // wrong master, allow redirect Assert.Equal(Value, b); // wrong master, allow redirect
var msgs = conn.FinishProfiling(profiler.MyContext).ToList(); var msgs = profiler.FinishProfiling().ToList();
// verify that things actually got recorded properly, and the retransmission profilings are connected as expected // verify that things actually got recorded properly, and the retransmission profilings are connected as expected
{ {
...@@ -754,6 +752,5 @@ public void MovedProfiling() ...@@ -754,6 +752,5 @@ public void MovedProfiling()
} }
} }
} }
#endif
} }
} }
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