-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from Drawaes/FullServiceList
Added callback
- Loading branch information
Showing
11 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
os: Visual Studio 2017 RC | ||
os: Visual Studio 2017 | ||
build: off | ||
|
||
environment: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<PackageReleaseNotes> | ||
* Added API to directly get the available service instance list via a callback | ||
* Removed TtlCheck1 property which was a duplicate from refactoring | ||
</PackageReleaseNotes> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using CondenserDotNet.Client; | ||
using CondenserDotNet.Client.Services; | ||
using Microsoft.Extensions.Options; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Condenser.Tests.Integration | ||
{ | ||
public class ListCallbackFacts | ||
{ | ||
[Fact] | ||
public async Task TestCallbackIsCalled() | ||
{ | ||
var serviceName = Guid.NewGuid().ToString(); | ||
var serviceCount = 100; | ||
var opts = Options.Create(new ServiceManagerConfig() { ServiceName = serviceName, ServicePort = 2222 }); | ||
using (var manager = new ServiceManager(opts)) | ||
using (var register = new ServiceRegistry()) | ||
{ | ||
register.SetServiceListCallback(serviceName, list => | ||
{ | ||
Volatile.Write(ref serviceCount, list?.Count ?? 0); | ||
}); | ||
await Task.Delay(500); | ||
Assert.Equal(0, serviceCount); | ||
|
||
manager.AddTtlHealthCheck(10); | ||
var registerResult = await manager.RegisterServiceAsync(); | ||
var ttlResult = await manager.TtlCheck.ReportPassingAsync(); | ||
|
||
await Task.Delay(500); | ||
Assert.Equal(1, serviceCount); | ||
|
||
ttlResult = await manager.TtlCheck.ReportFailAsync(); | ||
|
||
await Task.Delay(500); | ||
Assert.Equal(0, serviceCount); | ||
} | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<Project> | ||
<Project> | ||
<PropertyGroup> | ||
<VersionPrefix>2.0.6</VersionPrefix> | ||
<VersionPrefix>2.2.0</VersionPrefix> | ||
<VersionSuffix>beta</VersionSuffix> | ||
</PropertyGroup> | ||
</Project> |