Skip to content

Commit

Permalink
Remove IDatabaseContainer from LocalStackContainer and WebDriverConta…
Browse files Browse the repository at this point in the history
…iner

They aren't really databases.
  • Loading branch information
0xced committed Aug 31, 2023
1 parent ebc03d7 commit 3a88750
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Testcontainers.LocalStack/LocalStackContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Testcontainers.LocalStack;

/// <inheritdoc cref="DockerContainer" />
[PublicAPI]
public sealed class LocalStackContainer : DockerContainer, IDatabaseContainer
public sealed class LocalStackContainer : DockerContainer
{
/// <summary>
/// Initializes a new instance of the <see cref="LocalStackContainer" /> class.
Expand Down
2 changes: 1 addition & 1 deletion src/Testcontainers.WebDriver/WebDriverContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Testcontainers.WebDriver;

/// <inheritdoc cref="DockerContainer" />
[PublicAPI]
public sealed class WebDriverContainer : DockerContainer, IDatabaseContainer
public sealed class WebDriverContainer : DockerContainer
{
private readonly WebDriverConfiguration _configuration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ public void ImplementsIDatabaseContainerInterface(Type type)
Assert.True(type.IsAssignableTo(typeof(IDatabaseContainer)));
}

private static readonly HashSet<Type> NotDatabaseContainerTypes = new()
{
typeof(LocalStack.LocalStackContainer),
typeof(WebDriver.WebDriverContainer),
};

private static bool IsDatabaseContainerType(Type containerType) => !NotDatabaseContainerTypes.Contains(containerType);

public static IEnumerable<object[]> DatabaseContainersTheoryData
{
get
Expand All @@ -19,6 +27,7 @@ public static IEnumerable<object[]> DatabaseContainersTheoryData
return dependencyContext.RuntimeLibraries
.Where(library => library.Name.StartsWith("Testcontainers."))
.SelectMany(library => Assembly.Load(library.Name).GetExportedTypes().Where(HasGetConnectionStringMethod))
.Where(IsDatabaseContainerType)
.Select(type => new[] { type });
}
}
Expand Down

0 comments on commit 3a88750

Please sign in to comment.