This repository has been archived by the owner on Sep 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added IDisposable support to enable release of metrics port.
- Loading branch information
Giles Cope
committed
Oct 23, 2018
1 parent
f4d638d
commit 30de959
Showing
5 changed files
with
98 additions
and
19 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
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,50 @@ | ||
using System.Threading.Tasks; | ||
using NetGrpcPrometheusTest.Grpc; | ||
using NetGrpcPrometheusTest.Helpers; | ||
using NUnit.Framework; | ||
|
||
namespace NetGrpcPrometheusTest | ||
{ | ||
/// <summary> | ||
/// When Interceptor disposed should release all ports. | ||
/// </summary> | ||
[TestFixture] | ||
public class InterceptorTeardownTest | ||
{ | ||
private TestServer _server; | ||
private TestClient _client; | ||
|
||
[SetUp] | ||
public async Task SetUp() | ||
{ | ||
_server = new TestServer(); | ||
_client = new TestClient(TestServer.GrpcHostname, TestServer.GrpcPort, 9001); | ||
|
||
_client.UnaryCall(); | ||
await _client.UnaryCallAsync(); | ||
await _client.ClientStreamingCall(); | ||
await _client.ServerStreamingCall(); | ||
await _client.DuplexStreamingCall(); | ||
|
||
_client.UnaryCall(Status.Bad); | ||
await _client.UnaryCallAsync(Status.Bad); | ||
await _client.ClientStreamingCall(Status.Bad); | ||
await _client.ServerStreamingCall(Status.Bad); | ||
await _client.DuplexStreamingCall(Status.Bad); | ||
} | ||
|
||
[Test] | ||
public void TestFirstInvocationTeardown() {} | ||
|
||
[Test] | ||
public void TestSecondInvocationTeardown() {} | ||
|
||
[TearDown] | ||
public void TearDown() | ||
{ | ||
// These disposes should free the metric port. If not, the second SetUp call will fail. | ||
_server.Dispose(); | ||
_client.Dispose(); | ||
} | ||
} | ||
} |