So I have a redis code like this
public class RedisConnectorHelper
{
static RedisConnectorHelper()
{
RedisConnectorHelper.lazyConnection = new Lazy<ConnectionMultiplexer>(() =>
{
string redisServer = WebConfigurationManager.AppSettings["RedisServer"];
if (redisServer == null)
{
redisServer = "localhost";
}
return ConnectionMultiplexer.Connect(redisServer+ ",allowAdmin=true,abortConnect=false,ssl=True,");
}, System.Threading.LazyThreadSafetyMode.PublicationOnly);
}
Here is the part where the caching has been implemented,
public List<Division> GetDivisons()
{
if (CacheManager.Instance.IsDataSaved(CacheKey.Divisions))
{
return CacheManager.Instance.GetData<List<Division>>(CacheKey.Divisions);
}
else
{
CacheManager.Instance.SaveData<List<Division>>(CacheKey.Divisions, _notebookEntities.Divisions.ToList(), 30, ExpiryTimeUnit.Minutes);
return _notebookEntities.Divisions.ToList();
}
}
And the unit testing part,
[Test]
public void GetDivisons()
{
var result = _notebookService.GetDivisons();
Assert.NotNull(result);
}
but as soon as I uncomment the unit test which is shown below,the exception (shown below) occurs and the azure pipeline build fails, but passes as soon as I comment the unit test.
Here is the Exception,
StackExchange.Redis.RedisConnectionException : It was not possible to connect to the redis server(s). Error connecting right now. To allow this multiplexer to continue retrying until it's able to connect, use abortConnect=false in your connection string or AbortOnConnectFail=false; in your code. at StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(ConfigurationOptions configuration, TextWriter log, Nullable`1 serverType, EndPointCollection endpoints) at StackExchange.Redis.ConnectionMultiplexer.Connect(ConfigurationOptions configuration, TextWriter log) at StackExchange.Redis.ConnectionMultiplexer.Connect(String configuration, TextWriter log)
Is there any way to figure out what is the cause of it. i have tried with abortConnect=true & false and also with ssl=true but nothing works, as soon as I set to abortConnect= true I get a RedisTimeOutException