Skip to content

Commit 4b06a0b

Browse files
authored
Merge pull request #42 from SebastienDegodez/fix/unit-test-oauth
fix: ensure network are started asynchronously in InitializeAsync
2 parents af189ad + dec9806 commit 4b06a0b

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

tests/Microcks.Testcontainers.Tests/Async/MicrocksAsyncFeatureTest.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
//
1717

1818
using System;
19+
using System.Diagnostics;
1920
using System.Linq;
2021
using System.Net.WebSockets;
2122
using System.Text;
@@ -123,21 +124,25 @@ await webSocketClient.CloseAsync(
123124
[Fact]
124125
public async Task ShouldReturnsCorrectStatusContractWhenBadMessageIsEmitted()
125126
{
127+
var stopwatch = new Stopwatch();
126128
// New Test request
127129
var testRequest = new TestRequest
128130
{
129131
ServiceId = "Pastry orders API:0.1.0",
130132
RunnerType = TestRunnerType.ASYNC_API_SCHEMA,
131-
Timeout = TimeSpan.FromMilliseconds(70000),
133+
Timeout = TimeSpan.FromMilliseconds(70001),
132134
TestEndpoint = "ws://bad-impl:4001/websocket",
133135
};
134136

135137
var taskTestResult = _microcksContainerEnsemble.MicrocksContainer
136138
.TestEndpointAsync(testRequest);
139+
stopwatch.Start();
137140

138141
var testResult = await taskTestResult;
142+
stopwatch.Stop();
139143

140144
// Assert
145+
Assert.True(stopwatch.ElapsedMilliseconds > 70000);
141146
Assert.False(testResult.InProgress);
142147
Assert.False(testResult.Success);
143148
Assert.Equal(testRequest.TestEndpoint, testResult.TestedEndpoint);

tests/Microcks.Testcontainers.Tests/MicrocksContractTestingFunctionalityTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public Task InitializeAsync()
7474
(_, _) => _microcksContainer.ImportAsMainArtifact("apipastries-openapi.yaml");
7575

7676
return Task.WhenAll(
77+
_network.CreateAsync(),
7778
_microcksContainer.StartAsync(),
7879
_badImpl.StartAsync(),
7980
_goodImpl.StartAsync()

tests/Microcks.Testcontainers.Tests/MicrocksContractTestingFunctionalityWithOAuth2Tests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public Task InitializeAsync()
7373
(_, _) => _microcksContainer.ImportAsMainArtifact("apipastries-openapi.yaml");
7474

7575
return Task.WhenAll(
76+
_network.CreateAsync(),
7677
_microcksContainer.StartAsync(),
7778
_keycloak.StartAsync(),
7879
_goodImpl.StartAsync()

0 commit comments

Comments
 (0)