-
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#393] #CHANGE 'assemblyName: DotNet.Testcontainers; function: IWaitU…
…ntil' {Pass instance of ITestcontainersContainer to the wait strategies.}
- Loading branch information
1 parent
d9b1a40
commit 0f43416
Showing
26 changed files
with
129 additions
and
114 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 was deleted.
Oops, something went wrong.
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
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
4 changes: 2 additions & 2 deletions
4
src/DotNet.Testcontainers/Configurations/WaitStrategies/IWaitUntil.cs
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,11 +1,11 @@ | ||
namespace DotNet.Testcontainers.Configurations | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
using DotNet.Testcontainers.Containers; | ||
using Microsoft.Extensions.Logging; | ||
|
||
public interface IWaitUntil | ||
{ | ||
Task<bool> Until(Uri endpoint, string id, ILogger logger); | ||
Task<bool> Until(ITestcontainersContainer container, ILogger logger); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
src/DotNet.Testcontainers/Configurations/WaitStrategies/IWaitWhile.cs
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,11 +1,11 @@ | ||
namespace DotNet.Testcontainers.Configurations | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
using DotNet.Testcontainers.Containers; | ||
using Microsoft.Extensions.Logging; | ||
|
||
public interface IWaitWhile | ||
{ | ||
Task<bool> While(Uri endpoint, string id, ILogger logger); | ||
Task<bool> While(ITestcontainersContainer container, ILogger logger); | ||
} | ||
} |
12 changes: 2 additions & 10 deletions
12
src/DotNet.Testcontainers/Configurations/WaitStrategies/UntilContainerIsRunning.cs
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,25 +1,17 @@ | ||
namespace DotNet.Testcontainers.Configurations | ||
{ | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using DotNet.Testcontainers.Clients; | ||
using DotNet.Testcontainers.Containers; | ||
using Microsoft.Extensions.Logging; | ||
|
||
internal class UntilContainerIsRunning : IWaitUntil | ||
{ | ||
private static readonly TestcontainersState[] ContainerHasBeenRunningStates = { TestcontainersState.Running, TestcontainersState.Exited }; | ||
|
||
public async Task<bool> Until(Uri endpoint, string id, ILogger logger) | ||
public Task<bool> Until(ITestcontainersContainer container, ILogger logger) | ||
{ | ||
var client = new TestcontainersClient(endpoint, logger); | ||
|
||
var container = await client.GetContainer(id) | ||
.ConfigureAwait(false); | ||
|
||
var state = (TestcontainersState)Enum.Parse(typeof(TestcontainersState), container.State, true); | ||
return ContainerHasBeenRunningStates.Contains(state); | ||
return Task.FromResult(ContainerHasBeenRunningStates.Contains(container.State)); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.