Commit 5c31bb25 authored by Marc Gravell's avatar Marc Gravell

Merge branch 'master' into pipelines

parents 478f42b2 c6f30d93
......@@ -19,5 +19,6 @@ StackExchange.Redis.*.zip
.idea/
.vs/
*.lock.json
test-results*.xml
packages/
StackExchange.Redis.Tests/*Config.json
......@@ -36,24 +36,41 @@ public void ExportConfiguration()
}
[Fact]
public void ConnectUsesSingleSocket()
public async Task ConnectUsesSingleSocket()
{
for (int i = 0; i < 10; i++)
using (var sw = new StringWriter())
{
try
{
for (int i = 0; i < 5; i++)
{
using (var muxer = Create(failMessage: i + ": "))
using (var muxer = Create(failMessage: i + ": ", log: sw))
{
await Task.Delay(500);
foreach (var ep in muxer.GetEndPoints())
{
var srv = muxer.GetServer(ep);
var counters = srv.GetCounters();
Output.WriteLine($"{i}; interactive, {ep}, count: {counters.Interactive.SocketCount}");
Output.WriteLine($"{i}; subscription, {ep}, count: {counters.Subscription.SocketCount}");
}
foreach (var ep in muxer.GetEndPoints())
{
var srv = muxer.GetServer(ep);
var counters = srv.GetCounters();
Output.WriteLine(i + "; interactive, " + ep);
Assert.Equal(1, counters.Interactive.SocketCount);
Output.WriteLine(i + "; subscription, " + ep);
Assert.Equal(1, counters.Subscription.SocketCount);
}
}
}
}
finally
{
// Connection info goes at the end...
Output.WriteLine(sw.ToString());
}
}
}
[Fact]
public void CanGetTotalStats()
......
{
"methodDisplay": "classAndMethod",
"maxParallelThreads": 2
"maxParallelThreads": 3
}
\ No newline at end of file
......@@ -152,6 +152,7 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra
bool log = !message.IsInternalCall;
bool isMoved = result.AssertStarts(MOVED);
string err = string.Empty;
bool unableToConnectError = false;
if (isMoved || result.AssertStarts(ASK))
{
message.SetResponseReceived();
......@@ -178,6 +179,7 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra
}
else
{
unableToConnectError = true;
err = $"Endpoint {endpoint} serving hashslot {hashSlot} is not reachable at this point of time. Please check connectTimeout value. If it is low, try increasing it to give the ConnectionMultiplexer a chance to recover from the network disconnect. ";
}
#if FEATURE_PERFCOUNTER
......@@ -198,8 +200,15 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra
bridge.Multiplexer.OnErrorMessage(server.EndPoint, err);
}
connection.Multiplexer.Trace("Completed with error: " + err + " (" + GetType().Name + ")", ToString());
if (unableToConnectError)
{
ConnectionFail(message, ConnectionFailureType.UnableToConnect, err);
}
else
{
ServerFail(message, err);
}
}
else
{
bool coreResult = SetResultCore(connection, message, result);
......
......@@ -3,6 +3,7 @@ param(
[string] $Version,
[string] $BuildNumber,
[bool] $CreatePackages,
[switch] $StartServers,
[bool] $RunTests = $true,
[string] $PullRequestNumber
)
......@@ -64,13 +65,18 @@ if ($PullRequestNumber) {
}
if ($RunTests) {
if ($StartServers) {
Write-Host "Starting all servers for testing: $project (all frameworks)" -ForegroundColor "Magenta"
& .\RedisConfigs\start-all.cmd
Write-Host "Servers Started." -ForegroundColor "Green"
}
dotnet restore /ConsoleLoggerParameters:Verbosity=Quiet
foreach ($project in $testsToRun) {
Write-Host "Running tests: $project (all frameworks)" -ForegroundColor "Magenta"
#Push-Location ".\tests\$project"
Push-Location ".\$project"
dotnet xunit -configuration Release
dotnet xunit -configuration Release -xml ./test-results.xml
if ($LastExitCode -ne 0) {
Write-Host "Error with tests, aborting build." -Foreground "Red"
Pop-Location
......
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