testcontainers / testcontainers-dotnet

A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.
https://dotnet.testcontainers.org
MIT License
3.82k stars 278 forks source link

[Enhancement]: Add Redis Sentinel test container #1298

Open Alirexaa opened 1 week ago

Alirexaa commented 1 week ago

To use Redis for high availability, we use Redis Sentinel and provide multiple Redis instances to configure master and slave. Redis Sentinel monitors the master instance and provides a connection to the slave when the master is unavailable.

in c# code we use ConnectionMultiplexer.SentinelConnect(sentinelConfig); to get connection for this setup. And in our tests, we should use a sentinel connection instead of a standard connection. Its quite complicate to configure a test container to spin up the Redis Sentinel connection and I think we should have an package for making developer life easier.

I already implemented this test container in my project, and it took me 1 day to configure (it was a lot of time, and it made me crazy). I could send a PR for this package and save a lot of time for other developers.