Commit 5b49e324 authored by Nick Craver's avatar Nick Craver

Tests: Change Sentinel to StringWriter

This is tricky, because you can't write to it if there's no test, xUnit goes boom. We can't write to the ITestOutputHelper here without failing the suite depending on the race.

But still, want to avoid dumping to the console and build log directly.
parent 81aa67e5
using System;
using System.IO;
using System.Net;
using System.Threading;
using StackExchange.Redis.Tests.Helpers;
......@@ -13,13 +14,13 @@ public class Sentinel
private ConnectionMultiplexer Conn { get; }
private IServer Server { get; }
protected TextWriterOutputHelper Writer { get; }
protected StringWriter Log { get; }
public ITestOutputHelper Output { get; }
public Sentinel(ITestOutputHelper output)
{
Output = output;
Writer = new TextWriterOutputHelper(output);
Log = new StringWriter();
Skip.IfNoConfig(nameof(TestConfig.Config.SentinelServer), TestConfig.Current.SentinelServer);
Skip.IfNoConfig(nameof(TestConfig.Config.SentinelSeviceName), TestConfig.Current.SentinelSeviceName);
......@@ -33,7 +34,7 @@ public Sentinel(ITestOutputHelper output)
ServiceName = TestConfig.Current.SentinelSeviceName,
SyncTimeout = 5000
};
Conn = ConnectionMultiplexer.Connect(options, Writer);
Conn = ConnectionMultiplexer.Connect(options, Log);
Thread.Sleep(3000);
Assert.True(Conn.IsConnected);
Server = Conn.GetServer(TestConfig.Current.SentinelServer, TestConfig.Current.SentinelPort);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment