Skip to content

Commit

Permalink
Fix Redis docker bits
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCraver committed Aug 17, 2024
1 parent 42f6139 commit 2e8e755
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 37 deletions.
41 changes: 18 additions & 23 deletions tests/RedisConfigs/.docker/Envoy/envoy.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
admin:
access_log_path: "/dev/null"
address:
socket_address:
protocol: TCP
address: 0.0.0.0
port_value: 8001
address: { socket_address: { protocol: TCP, address: 0.0.0.0, port_value: 8001 } }
static_resources:
listeners:
- name: redis_listener
address:
socket_address:
address: 0.0.0.0
port_value: 7015
address: { socket_address: { protocol: TCP, address: 0.0.0.0, port_value: 7015 } }
filter_chains:
- filters:
- name: envoy.filters.network.redis_proxy
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.redis_proxy.v3.RedisProxy
stat_prefix: envoy_redis_stats
settings:
op_timeout: 5s
enable_redirection: true
op_timeout: 3s
dns_cache_config:
name: dynamic_forward_proxy_cache_config
dns_lookup_family: V4_ONLY
prefix_routes:
catch_all_route:
cluster: cluster_redis
cluster: redis_cluster
clusters:
- name: cluster_redis
connect_timeout: 1s
- name: redis_cluster
connect_timeout: 3s
type: STRICT_DNS
dns_lookup_family: V4_ONLY
load_assignment:
cluster_name: cluster_redis
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: host.docker.internal
port_value: 7000
cluster_name: redis_cluster
endpoints:
- lb_endpoints:
- endpoint: { address: { socket_address: { address: redis, port_value: 7000 } } }
- endpoint: { address: { socket_address: { address: redis, port_value: 7001 } } }
- endpoint: { address: { socket_address: { address: redis, port_value: 7002 } } }
- endpoint: { address: { socket_address: { address: redis, port_value: 7003 } } }
- endpoint: { address: { socket_address: { address: redis, port_value: 7004 } } }
- endpoint: { address: { socket_address: { address: redis, port_value: 7005 } } }
18 changes: 11 additions & 7 deletions tests/RedisConfigs/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,22 @@ services:
image: stackexchange/redis-tests:latest
platform: linux
ports:
- 6379-6384:6379-6384
- 7000-7006:7000-7006
- 7010-7011:7010-7011
- 26379-26381:26379-26381
- 6379-6384:6379-6384 # Misc
- 7000-7006:7000-7006 # Cluster
- 7010-7011:7010-7011 # Sentinel Controllers
- 26379-26381:26379-26381 # Sentinel Data
sysctls :
net.core.somaxconn: '511'
envoy:
build:
context: .docker/Envoy
image: stackexchange/redis-tests-envoy:latest
platform: linux
healthcheck:
test: ["CMD-SHELL", "redis-cli -p 7015 ping | grep PONG"]
environment:
loglevel: warning
depends_on:
redis:
condition: service_started
ports:
- 7015:7015
- 7015:7015 # Cluster
- 8001:8001 # Admin
12 changes: 5 additions & 7 deletions tests/StackExchange.Redis.Tests/Helpers/Attributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,14 @@ public static IEnumerable<IXunitTestCase> Expand(this ITestMethod testMethod, Fu
{
protocols = RunPerProtocol.AllProtocols;
}
var results = new List<IXunitTestCase>();
foreach (var protocol in protocols)
{
results.Add(generator(protocol));
yield return generator(protocol);
}
return results;
}
else
{
return new[] { generator(RedisProtocol.Resp2) };
yield return generator(RedisProtocol.Resp2);
}
}
}
Expand All @@ -270,7 +268,7 @@ public static IEnumerable<IXunitTestCase> Expand(this ITestMethod testMethod, Fu
/// <see cref="Thread.CurrentThread" /> and <see cref="CultureInfo.CurrentCulture" /> with another culture.
/// </summary>
/// <remarks>
/// Based on: https://bartwullems.blogspot.com/2022/03/xunit-change-culture-during-your-test.html
/// Based on: https://bartwullems.blogspot.com/2022/03/xunit-change-culture-during-your-test.html.
/// </remarks>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class TestCultureAttribute : BeforeAfterTestAttribute
Expand All @@ -288,7 +286,7 @@ public class TestCultureAttribute : BeforeAfterTestAttribute
/// Stores the current <see cref="Thread.CurrentPrincipal" /> and <see cref="CultureInfo.CurrentCulture" />
/// and replaces them with the new cultures defined in the constructor.
/// </summary>
/// <param name="methodUnderTest">The method under test</param>
/// <param name="methodUnderTest">The method under test.</param>
public override void Before(MethodInfo methodUnderTest)
{
originalCulture = Thread.CurrentThread.CurrentCulture;
Expand All @@ -299,7 +297,7 @@ public override void Before(MethodInfo methodUnderTest)
/// <summary>
/// Restores the original <see cref="CultureInfo.CurrentCulture" /> to <see cref="Thread.CurrentPrincipal" />.
/// </summary>
/// <param name="methodUnderTest">The method under test</param>
/// <param name="methodUnderTest">The method under test.</param>
public override void After(MethodInfo methodUnderTest)
{
if (originalCulture is not null)
Expand Down

0 comments on commit 2e8e755

Please sign in to comment.