Commit f74d650c authored by Nick Craver's avatar Nick Craver

Cleanup: misc tests

parent 3e949794
...@@ -20,7 +20,7 @@ public void AggressiveParallel() ...@@ -20,7 +20,7 @@ public void AggressiveParallel()
using (var c1 = GetUnsecuredConnection(waitForOpen: true)) using (var c1 = GetUnsecuredConnection(waitForOpen: true))
using (var c2 = GetUnsecuredConnection(waitForOpen: true)) using (var c2 = GetUnsecuredConnection(waitForOpen: true))
{ {
WaitCallback cb = obj => void cb(object obj)
{ {
var conn = (ConnectionMultiplexer)obj; var conn = (ConnectionMultiplexer)obj;
conn.InternalError += (o, e) => conn.InternalError += (o, e) =>
...@@ -41,7 +41,7 @@ public void AggressiveParallel() ...@@ -41,7 +41,7 @@ public void AggressiveParallel()
db.Ping(); db.Ping();
conn.Close(false); conn.Close(false);
if (Interlocked.Decrement(ref count) == 0) evt.Set(); if (Interlocked.Decrement(ref count) == 0) evt.Set();
}; }
ThreadPool.QueueUserWorkItem(cb, c1); ThreadPool.QueueUserWorkItem(cb, c1);
ThreadPool.QueueUserWorkItem(cb, c2); ThreadPool.QueueUserWorkItem(cb, c2);
evt.WaitOne(8000); evt.WaitOne(8000);
......
...@@ -182,7 +182,7 @@ public void Issue38() ...@@ -182,7 +182,7 @@ public void Issue38()
{ {
var sub = pub.GetSubscriber(); var sub = pub.GetSubscriber();
int count = 0; int count = 0;
Action<RedisChannel, RedisValue> handler = (channel, payload) => Interlocked.Increment(ref count); void handler(RedisChannel channel, RedisValue payload) => Interlocked.Increment(ref count);
var a0 = sub.SubscribeAsync("foo", handler); var a0 = sub.SubscribeAsync("foo", handler);
var a1 = sub.SubscribeAsync("bar", handler); var a1 = sub.SubscribeAsync("bar", handler);
var b0 = sub.SubscribeAsync("f*o", handler); var b0 = sub.SubscribeAsync("f*o", handler);
......
...@@ -29,7 +29,7 @@ public async Task NoticesConnectFail() ...@@ -29,7 +29,7 @@ public async Task NoticesConnectFail()
Assert.Throws<RedisConnectionException>(() => server.Ping()); Assert.Throws<RedisConnectionException>(() => server.Ping());
// Heartbeat should reconnect by now // Heartbeat should reconnect by now
await Task.Delay(5000); await Task.Delay(5000).ConfigureAwait(false);
var time = server.Ping(); var time = server.Ping();
Output.WriteLine(time.ToString()); Output.WriteLine(time.ToString());
......

// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.ConnectionFailedErrors.SSLCertificateValidationError(System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.Booksleeve.PubSub.TestMultipleSubscribersGetMessage")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.PubSub.ExplicitPublishMode")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.PubSubNonParallel.SubscriptionsSurviveMasterSwitch(System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.PubSub.TestBasicPubSubFireAndForget(System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.Booksleeve.PubSub.Issue38")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.SSL.ConnectToSSLServer(System.Boolean,System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.PubSub.TestPatternPubSub(System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.PubSub.TestBasicPubSub(System.Boolean,System.String,System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.SSL.ConnectToSSLServer(System.Boolean,System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.Booksleeve.PubSub.PubSubOrder~System.Threading.Tasks.Task")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.PreserveOrder.Execute(System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "xUnit1004:Test methods should not be skipped", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.ConnectionShutdown.ShutdownRaisesConnectionFailedAndRestore")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "xUnit1004:Test methods should not be skipped", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.Issues.BgSaveResponse.ShouldntThrowException(StackExchange.Redis.SaveType)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "xUnit1004:Test methods should not be skipped", Justification = "<Pending>", Scope = "member", Target = "~M:StackExchange.Redis.Tests.Issues.BgSaveResponse.ShouldntThrowException(StackExchange.Redis.SaveType)")]
...@@ -8,9 +8,6 @@ public class BgSaveResponse : TestBase ...@@ -8,9 +8,6 @@ public class BgSaveResponse : TestBase
public BgSaveResponse(ITestOutputHelper output) : base (output) { } public BgSaveResponse(ITestOutputHelper output) : base (output) { }
[Theory (Skip = "We don't need to test this, and it really screws local testing hard.")] [Theory (Skip = "We don't need to test this, and it really screws local testing hard.")]
#pragma warning disable 0618
//[InlineData(SaveType.ForegroundSave)]
#pragma warning restore 0618
[InlineData(SaveType.BackgroundSave)] [InlineData(SaveType.BackgroundSave)]
[InlineData(SaveType.BackgroundRewriteAppendOnlyFile)] [InlineData(SaveType.BackgroundRewriteAppendOnlyFile)]
public void ShouldntThrowException(SaveType saveType) public void ShouldntThrowException(SaveType saveType)
......
...@@ -7,7 +7,6 @@ public class Issue791 : TestBase ...@@ -7,7 +7,6 @@ public class Issue791 : TestBase
{ {
public Issue791(ITestOutputHelper output) : base(output) { } public Issue791(ITestOutputHelper output) : base(output) { }
[Fact] [Fact]
public void PreserveAsyncOrderImplicitValue_ParsedFromConnectionString() public void PreserveAsyncOrderImplicitValue_ParsedFromConnectionString()
{ {
...@@ -20,7 +19,6 @@ public void PreserveAsyncOrderImplicitValue_ParsedFromConnectionString() ...@@ -20,7 +19,6 @@ public void PreserveAsyncOrderImplicitValue_ParsedFromConnectionString()
Assert.Equal("preserveAsyncOrder=False", options.ToString()); Assert.Equal("preserveAsyncOrder=False", options.ToString());
} }
[Fact] [Fact]
public void DefaultValue_IsTrue() public void DefaultValue_IsTrue()
{ {
...@@ -28,7 +26,6 @@ public void DefaultValue_IsTrue() ...@@ -28,7 +26,6 @@ public void DefaultValue_IsTrue()
Assert.True(options.PreserveAsyncOrder); Assert.True(options.PreserveAsyncOrder);
} }
[Fact] [Fact]
public void PreserveAsyncOrder_SetConnectionMultiplexerProperty() public void PreserveAsyncOrder_SetConnectionMultiplexerProperty()
{ {
......
...@@ -31,11 +31,11 @@ public void AggressiveParallel(TestMode testMode) ...@@ -31,11 +31,11 @@ public void AggressiveParallel(TestMode testMode)
{ {
int count = 2; int count = 2;
int errorCount = 0; int errorCount = 0;
ManualResetEvent evt = new ManualResetEvent(false); var evt = new ManualResetEvent(false);
using (var c1 = Create(testMode)) using (var c1 = Create(testMode))
using (var c2 = Create(testMode)) using (var c2 = Create(testMode))
{ {
WaitCallback cb = obj => void cb(object obj)
{ {
var conn = (IDatabase)obj; var conn = (IDatabase)obj;
conn.Multiplexer.ErrorMessage += delegate { Interlocked.Increment(ref errorCount); }; conn.Multiplexer.ErrorMessage += delegate { Interlocked.Increment(ref errorCount); };
...@@ -46,7 +46,7 @@ public void AggressiveParallel(TestMode testMode) ...@@ -46,7 +46,7 @@ public void AggressiveParallel(TestMode testMode)
} }
conn.Ping(); conn.Ping();
if (Interlocked.Decrement(ref count) == 0) evt.Set(); if (Interlocked.Decrement(ref count) == 0) evt.Set();
}; }
int db = testMode == TestMode.Twemproxy ? 0 : 2; int db = testMode == TestMode.Twemproxy ? 0 : 2;
ThreadPool.QueueUserWorkItem(cb, c1.GetDatabase(db)); ThreadPool.QueueUserWorkItem(cb, c1.GetDatabase(db));
ThreadPool.QueueUserWorkItem(cb, c2.GetDatabase(db)); ThreadPool.QueueUserWorkItem(cb, c2.GetDatabase(db));
......
...@@ -256,7 +256,6 @@ public void TestPatternPubSub(bool preserveOrder) ...@@ -256,7 +256,6 @@ public void TestPatternPubSub(bool preserveOrder)
[Fact] [Fact]
public void SubscriptionsSurviveConnectionFailure() public void SubscriptionsSurviveConnectionFailure()
{ {
using (var muxer = Create(allowAdmin: true)) using (var muxer = Create(allowAdmin: true))
{ {
RedisChannel channel = Me(); RedisChannel channel = Me();
...@@ -284,6 +283,7 @@ public void SubscriptionsSurviveConnectionFailure() ...@@ -284,6 +283,7 @@ public void SubscriptionsSurviveConnectionFailure()
} }
#endif #endif
} }
internal static class VolatileWrapper internal static class VolatileWrapper
{ {
public static int Read(ref int location) public static int Read(ref int location)
......
...@@ -37,7 +37,8 @@ public void KeysScan(bool supported) ...@@ -37,7 +37,8 @@ public void KeysScan(bool supported)
} }
} }
private void ScansIScanning() [Fact]
public void ScansIScanning()
{ {
using (var conn = Create(allowAdmin: true)) using (var conn = Create(allowAdmin: true))
{ {
...@@ -83,7 +84,8 @@ private void ScansIScanning() ...@@ -83,7 +84,8 @@ private void ScansIScanning()
} }
} }
private void ScanResume() [Fact]
public void ScanResume()
{ {
using (var conn = Create(allowAdmin: true)) using (var conn = Create(allowAdmin: true))
{ {
......
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