Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Alirexaa committed Dec 16, 2024
1 parent 5abb720 commit db9f509
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
17 changes: 5 additions & 12 deletions test/HealthChecks.Redis.Tests/Functional/RedisHealthCheckTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@

namespace HealthChecks.Redis.Tests.Functional;

public class redis_healthcheck_should : IClassFixture<RedisContainerFixture>
public class redis_healthcheck_should(RedisContainerFixture redisContainerFixture) : IClassFixture<RedisContainerFixture>
{
private readonly RedisContainerFixture _redisContainerFixture;

public redis_healthcheck_should(RedisContainerFixture redisContainerFixture)
{
_redisContainerFixture = redisContainerFixture;
}

[Fact]
public async Task be_healthy_if_redis_is_available_with_connection_string()
{
var connectionString = $"{_redisContainerFixture.GetConnectionString()},allowAdmin=true";
var connectionString = $"{redisContainerFixture.GetConnectionString()},allowAdmin=true";

var webHostBuilder = new WebHostBuilder()
.ConfigureServices(services =>
Expand All @@ -43,7 +36,7 @@ public async Task be_healthy_if_redis_is_available_with_connection_string()
[Fact]
public async Task be_healthy_if_multiple_redis_are_available_with_connection_string()
{
var connectionString = $"{_redisContainerFixture.GetConnectionString()},allowAdmin=true";
var connectionString = $"{redisContainerFixture.GetConnectionString()},allowAdmin=true";

var webHostBuilder = new WebHostBuilder()
.ConfigureServices(services =>
Expand All @@ -70,7 +63,7 @@ public async Task be_healthy_if_multiple_redis_are_available_with_connection_str
[Fact]
public async Task be_healthy_if_redis_is_available_with_connection_multiplexer()
{
var connectionString = $"{_redisContainerFixture.GetConnectionString()},allowAdmin=true";
var connectionString = $"{redisContainerFixture.GetConnectionString()},allowAdmin=true";

var connectionMultiplexer = await ConnectionMultiplexer
.ConnectAsync(connectionString);
Expand Down Expand Up @@ -99,7 +92,7 @@ public async Task be_healthy_if_redis_is_available_with_connection_multiplexer()
[Fact]
public async Task be_healthy_if_multiple_redis_are_available_with_connection_multiplexer()
{
var connectionString = $"{_redisContainerFixture.GetConnectionString()},allowAdmin=true";
var connectionString = $"{redisContainerFixture.GetConnectionString()},allowAdmin=true";

var connectionMultiplexer = await ConnectionMultiplexer
.ConnectAsync(connectionString);
Expand Down
8 changes: 7 additions & 1 deletion test/HealthChecks.Redis.Tests/RedisContainerFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ namespace HealthChecks.Redis.Tests;

public sealed class RedisContainerFixture : IAsyncLifetime
{
public const string Registry = "docker.io";

public const string Image = "library/redis";

public const string Tag = "7.4";

public RedisContainer? Container { get; private set; }

public string GetConnectionString() => Container?.GetConnectionString() ??
Expand All @@ -20,7 +26,7 @@ public async Task DisposeAsync()
public static async Task<RedisContainer> CreateContainerAsync()
{
var container = new RedisBuilder()
.WithImage($"{RedisContainerImageTags.Registry}/{RedisContainerImageTags.Image}:{RedisContainerImageTags.Tag}")
.WithImage($"{Registry}/{Image}:{Tag}")
.Build();
await container.StartAsync();

Expand Down
10 changes: 0 additions & 10 deletions test/HealthChecks.Redis.Tests/RedisContainerImageTags.cs

This file was deleted.

0 comments on commit db9f509

Please sign in to comment.