Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] More Conformance tests should use Testcontainers #5254

Open
1 of 3 tasks
radical opened this issue Aug 10, 2024 · 1 comment
Open
1 of 3 tasks

[tests] More Conformance tests should use Testcontainers #5254

radical opened this issue Aug 10, 2024 · 1 comment
Labels
area-integrations Issues pertaining to Aspire Integrations packages testing ☑️ tracking Tracking issue for some TODOs untriaged New issue has not been triaged

Comments

@radical
Copy link
Member

radical commented Aug 10, 2024

.. similar to how others do this.

public sealed class RedisContainerFixture : IAsyncLifetime
{
public RedisContainer? Container { get; private set; }
public string GetConnectionString() => Container?.GetConnectionString() ??
throw new InvalidOperationException("The test container was not initialized.");
public async Task InitializeAsync()
{
if (RequiresDockerAttribute.IsSupported)
{
Container = await CreateContainerAsync();
}
}
public async Task DisposeAsync()
{
if (Container is not null)
{
await Container.DisposeAsync();
}
}
public static async Task<RedisContainer> CreateContainerAsync()
{
var container = new RedisBuilder()
.WithImage($"{TestConstants.AspireTestContainerRegistry}/{RedisContainerImageTags.Image}:{RedisContainerImageTags.Tag}")
.Build();
await container.StartAsync();
return container;
}
}

protected string ConnectionString => _containerFixture.GetConnectionString();

Currently any tests that need to connect get skipped with Unable to connect to server.

cc @eerhardt @sebastienros @joperezr

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-integrations Issues pertaining to Aspire Integrations packages label Aug 10, 2024
@radical radical changed the title [tests] Qdrant Conformance tests should use Testcontainers.Qdrant [tests] More Conformance tests should use Testcontainers Aug 12, 2024
@eerhardt
Copy link
Member

Qdrant

See testcontainers/testcontainers-dotnet#992

RabbitMq

RabbitMQ is already using testcontainers:

public static async Task<RabbitMqContainer> CreateContainerAsync()
{
var container = new RabbitMqBuilder()
.WithImage($"{TestConstants.AspireTestContainerRegistry}/{RabbitMQContainerImageTags.Image}:{RabbitMQContainerImageTags.Tag}")
.Build();

@radical radical added the tracking Tracking issue for some TODOs label Aug 22, 2024
@joperezr joperezr added the untriaged New issue has not been triaged label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-integrations Issues pertaining to Aspire Integrations packages testing ☑️ tracking Tracking issue for some TODOs untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

3 participants