-
-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#126] #IMPLEMENT 'assemblyName: DotNet.Testcontainers; function: Con…
…tainerRegistry' {Purge orphaned containers when the default application domain's parent process exits.}
- Loading branch information
1 parent
3e21c90
commit e5fd0cb
Showing
14 changed files
with
101 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
namespace DotNet.Testcontainers.Clients | ||
{ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
internal static class ContainerRegistry | ||
{ | ||
private static readonly object RegisteredContainersPadLock = new object(); | ||
|
||
private static readonly IDictionary<string, bool> RegisteredContainers = new Dictionary<string, bool>(); | ||
|
||
public static IEnumerable<string> GetRegisteredContainers() | ||
{ | ||
lock (RegisteredContainersPadLock) | ||
{ | ||
return RegisteredContainers.Where(registeredContainer => true.Equals(registeredContainer.Value)).Select(registeredContainer => registeredContainer.Key); | ||
} | ||
} | ||
|
||
public static void Register(string id, bool cleanUp = false) | ||
{ | ||
lock (RegisteredContainersPadLock) | ||
{ | ||
RegisteredContainers.Add(id, cleanUp); | ||
} | ||
} | ||
|
||
public static void Unregister(string id) | ||
{ | ||
lock (RegisteredContainersPadLock) | ||
{ | ||
RegisteredContainers.Remove(id); | ||
} | ||
} | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
....Testcontainers/Core/DockerfileArchive.cs → ...tainers/Core/Archive/DockerfileArchive.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
2 changes: 1 addition & 1 deletion
2
...DotNet.Testcontainers/Core/ITarArchive.cs → ...estcontainers/Core/Archive/ITarArchive.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
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