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 ...@@ -19,5 +19,6 @@ StackExchange.Redis.*.zip
.idea/ .idea/
.vs/ .vs/
*.lock.json *.lock.json
test-results*.xml
packages/ packages/
StackExchange.Redis.Tests/*Config.json StackExchange.Redis.Tests/*Config.json
...@@ -36,24 +36,41 @@ public void ExportConfiguration() ...@@ -36,24 +36,41 @@ public void ExportConfiguration()
} }
[Fact] [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()) foreach (var ep in muxer.GetEndPoints())
{ {
var srv = muxer.GetServer(ep); var srv = muxer.GetServer(ep);
var counters = srv.GetCounters(); var counters = srv.GetCounters();
Output.WriteLine(i + "; interactive, " + ep);
Assert.Equal(1, counters.Interactive.SocketCount); Assert.Equal(1, counters.Interactive.SocketCount);
Output.WriteLine(i + "; subscription, " + ep);
Assert.Equal(1, counters.Subscription.SocketCount); Assert.Equal(1, counters.Subscription.SocketCount);
} }
} }
} }
} }
finally
{
// Connection info goes at the end...
Output.WriteLine(sw.ToString());
}
}
}
[Fact] [Fact]
public void CanGetTotalStats() public void CanGetTotalStats()
......
{ {
"methodDisplay": "classAndMethod", "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 ...@@ -152,6 +152,7 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra
bool log = !message.IsInternalCall; bool log = !message.IsInternalCall;
bool isMoved = result.AssertStarts(MOVED); bool isMoved = result.AssertStarts(MOVED);
string err = string.Empty; string err = string.Empty;
bool unableToConnectError = false;
if (isMoved || result.AssertStarts(ASK)) if (isMoved || result.AssertStarts(ASK))
{ {
message.SetResponseReceived(); message.SetResponseReceived();
...@@ -178,6 +179,7 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra ...@@ -178,6 +179,7 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra
} }
else 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. "; 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 #if FEATURE_PERFCOUNTER
...@@ -198,8 +200,15 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra ...@@ -198,8 +200,15 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra
bridge.Multiplexer.OnErrorMessage(server.EndPoint, err); bridge.Multiplexer.OnErrorMessage(server.EndPoint, err);
} }
connection.Multiplexer.Trace("Completed with error: " + err + " (" + GetType().Name + ")", ToString()); connection.Multiplexer.Trace("Completed with error: " + err + " (" + GetType().Name + ")", ToString());
if (unableToConnectError)
{
ConnectionFail(message, ConnectionFailureType.UnableToConnect, err);
}
else
{
ServerFail(message, err); ServerFail(message, err);
} }
}
else else
{ {
bool coreResult = SetResultCore(connection, message, result); bool coreResult = SetResultCore(connection, message, result);
......
...@@ -3,6 +3,7 @@ param( ...@@ -3,6 +3,7 @@ param(
[string] $Version, [string] $Version,
[string] $BuildNumber, [string] $BuildNumber,
[bool] $CreatePackages, [bool] $CreatePackages,
[switch] $StartServers,
[bool] $RunTests = $true, [bool] $RunTests = $true,
[string] $PullRequestNumber [string] $PullRequestNumber
) )
...@@ -64,13 +65,18 @@ if ($PullRequestNumber) { ...@@ -64,13 +65,18 @@ if ($PullRequestNumber) {
} }
if ($RunTests) { 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 dotnet restore /ConsoleLoggerParameters:Verbosity=Quiet
foreach ($project in $testsToRun) { foreach ($project in $testsToRun) {
Write-Host "Running tests: $project (all frameworks)" -ForegroundColor "Magenta" Write-Host "Running tests: $project (all frameworks)" -ForegroundColor "Magenta"
#Push-Location ".\tests\$project" #Push-Location ".\tests\$project"
Push-Location ".\$project" Push-Location ".\$project"
dotnet xunit -configuration Release dotnet xunit -configuration Release -xml ./test-results.xml
if ($LastExitCode -ne 0) { if ($LastExitCode -ne 0) {
Write-Host "Error with tests, aborting build." -Foreground "Red" Write-Host "Error with tests, aborting build." -Foreground "Red"
Pop-Location 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