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,22 +36,39 @@ public void ExportConfiguration() ...@@ -36,22 +36,39 @@ public void ExportConfiguration()
} }
[Fact] [Fact]
public void ConnectUsesSingleSocket() public async Task ConnectUsesSingleSocket()
{ {
for (int i = 0; i < 10; i++) using (var sw = new StringWriter())
{ {
using (var muxer = Create(failMessage: i + ": ")) try
{ {
foreach (var ep in muxer.GetEndPoints()) for (int i = 0; i < 5; i++)
{ {
var srv = muxer.GetServer(ep); using (var muxer = Create(failMessage: i + ": ", log: sw))
var counters = srv.GetCounters(); {
Output.WriteLine(i + "; interactive, " + ep); await Task.Delay(500);
Assert.Equal(1, counters.Interactive.SocketCount); foreach (var ep in muxer.GetEndPoints())
Output.WriteLine(i + "; subscription, " + ep); {
Assert.Equal(1, counters.Subscription.SocketCount); 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();
Assert.Equal(1, counters.Interactive.SocketCount);
Assert.Equal(1, counters.Subscription.SocketCount);
}
}
} }
} }
finally
{
// Connection info goes at the end...
Output.WriteLine(sw.ToString());
}
} }
} }
......
{ {
"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,7 +200,14 @@ public virtual bool SetResult(PhysicalConnection connection, Message message, Ra ...@@ -198,7 +200,14 @@ 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());
ServerFail(message, err); if (unableToConnectError)
{
ConnectionFail(message, ConnectionFailureType.UnableToConnect, err);
}
else
{
ServerFail(message, err);
}
} }
else else
{ {
......
...@@ -3,10 +3,11 @@ param( ...@@ -3,10 +3,11 @@ 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
) )
function CalculateVersion() { function CalculateVersion() {
if ($Version) { if ($Version) {
return $Version return $Version
...@@ -64,14 +65,19 @@ if ($PullRequestNumber) { ...@@ -64,14 +65,19 @@ 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
Exit 1 Exit 1
...@@ -93,7 +99,7 @@ if ($CreatePackages) { ...@@ -93,7 +99,7 @@ if ($CreatePackages) {
foreach ($project in $projectsToBuild) { foreach ($project in $projectsToBuild) {
Write-Host "Working on $project`:" -ForegroundColor "Magenta" Write-Host "Working on $project`:" -ForegroundColor "Magenta"
#Push-Location ".\src\$project" #Push-Location ".\src\$project"
Push-Location ".\$project" Push-Location ".\$project"
...@@ -108,7 +114,7 @@ foreach ($project in $projectsToBuild) { ...@@ -108,7 +114,7 @@ foreach ($project in $projectsToBuild) {
Write-Host "$project... (Version:" -NoNewline -ForegroundColor "Magenta" Write-Host "$project... (Version:" -NoNewline -ForegroundColor "Magenta"
Write-Host $semVer -NoNewline -ForegroundColor "Cyan" Write-Host $semVer -NoNewline -ForegroundColor "Cyan"
Write-Host ")" -ForegroundColor "Magenta" Write-Host ")" -ForegroundColor "Magenta"
dotnet msbuild "/t:$targets" "/p:Configuration=Release" "/p:Version=$semVer" "/p:PackageOutputPath=$packageOutputFolder" "/p:CI=true" dotnet msbuild "/t:$targets" "/p:Configuration=Release" "/p:Version=$semVer" "/p:PackageOutputPath=$packageOutputFolder" "/p:CI=true"
......
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