[fix]降低RedisCacheProvider对IConfigProvider的依赖,在外部没有注册IConfigProvider时(常见于没有星尘),自动加载本地配置文件。
大石头 编写于 2024-10-31 09:19:20
NewLife.Redis
using NewLife.Caching.Clusters;
using Xunit;

namespace XUnitTest.Clusters;

public class SentinelInfoTests
{
    [Fact]
    public void Parse()
    {
        var str = "127.0.0.1,7003,2890784206bf38ba9f9fbf7b61547f8524331c7a,0,mymaster,127.0.0.1,6379,0";

        var inf = SentinelInfo.Parse(str);
        Assert.NotNull(inf);
        Assert.Equal("127.0.0.1", inf.IP);
        Assert.Equal(7003, inf.Port);
        Assert.Equal("2890784206bf38ba9f9fbf7b61547f8524331c7a", inf.RunId);
        Assert.Equal(0, inf.Age);
        Assert.Equal("mymaster", inf.MasterName);
        Assert.Equal("127.0.0.1", inf.MasterIP);
        Assert.Equal(6379, inf.MasterPort);
        Assert.Equal(0, inf.MasterAge);
    }
}