Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
e4ff06f7
Commit
e4ff06f7
authored
Aug 08, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DebugAids/Tests: remove a lot of #if DEBUG differences
parent
2c307067
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
23 additions
and
66 deletions
+23
-66
AsyncTests.cs
StackExchange.Redis.Tests/AsyncTests.cs
+0
-2
BasicOps.cs
StackExchange.Redis.Tests/BasicOps.cs
+0
-4
ConnectingFailDetection.cs
StackExchange.Redis.Tests/ConnectingFailDetection.cs
+0
-2
ConnectionFailedErrors.cs
StackExchange.Redis.Tests/ConnectionFailedErrors.cs
+1
-2
ConnectionShutdown.cs
StackExchange.Redis.Tests/ConnectionShutdown.cs
+0
-2
ExceptionFactoryTests.cs
StackExchange.Redis.Tests/ExceptionFactoryTests.cs
+1
-2
ConnectionMultiplexer.cs
...change.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
+9
-0
DebuggingAids.cs
StackExchange.Redis/StackExchange/Redis/DebuggingAids.cs
+0
-37
IConnectionMultiplexer.cs
.../StackExchange/Redis/Interfaces/IConnectionMultiplexer.cs
+0
-11
PhysicalConnection.cs
...kExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
+12
-4
No files found.
StackExchange.Redis.Tests/AsyncTests.cs
View file @
e4ff06f7
...
...
@@ -14,7 +14,6 @@ public class AsyncTests : TestBase
protected
override
string
GetConfiguration
()
=>
TestConfig
.
Current
.
MasterServerAndPort
;
#if DEBUG // IRedisServerDebug and AllowConnect are only available if DEBUG is defined
[
Fact
]
public
void
AsyncTasksReportFailureIfServerUnavailable
()
{
...
...
@@ -43,7 +42,6 @@ public void AsyncTasksReportFailureIfServerUnavailable()
Assert
.
StartsWith
(
"No connection is available to service this operation: SADD "
+
key
.
ToString
(),
ex
.
Message
);
}
}
#endif
[
Fact
]
public
async
Task
AsyncTimeoutIsNoticed
()
...
...
StackExchange.Redis.Tests/BasicOps.cs
View file @
e4ff06f7
...
...
@@ -4,7 +4,6 @@
using
Xunit
;
using
Xunit.Abstractions
;
using
System.Diagnostics
;
using
System.Threading
;
namespace
StackExchange.Redis.Tests
{
...
...
@@ -310,8 +309,6 @@ public async Task TestQuit()
}
}
#if DEBUG
[
Fact
]
public
async
Task
TestSevered
()
{
...
...
@@ -332,7 +329,6 @@ public async Task TestSevered()
Assert
.
Equal
(
key
,
db
.
StringGet
(
key
));
}
}
#endif
[
Fact
]
public
async
Task
IncrAsync
()
...
...
StackExchange.Redis.Tests/ConnectingFailDetection.cs
View file @
e4ff06f7
...
...
@@ -11,7 +11,6 @@ public class ConnectingFailDetection : TestBase
protected
override
string
GetConfiguration
()
=>
TestConfig
.
Current
.
MasterServerAndPort
+
","
+
TestConfig
.
Current
.
SlaveServerAndPort
;
#if DEBUG
[
Fact
]
public
async
Task
FastNoticesFailOnConnectingSyncComlpetion
()
{
...
...
@@ -110,6 +109,5 @@ public async Task FastNoticesFailOnConnectingAsyncComlpetion()
ClearAmbientFailures
();
}
}
#endif
}
}
StackExchange.Redis.Tests/ConnectionFailedErrors.cs
View file @
e4ff06f7
...
...
@@ -124,7 +124,7 @@ public void SocketFailureError()
Assert
.
False
(
true
);
// force fail
}
}
#if DEBUG // needs AllowConnect, which is DEBUG only
[
Fact
]
public
void
AbortOnConnectFailFalseConnectTimeoutError
()
{
...
...
@@ -172,7 +172,6 @@ public async Task CheckFailureRecovered()
}
}
#endif
[
Fact
]
public
void
TryGetAzureRoleInstanceIdNoThrow
()
{
...
...
StackExchange.Redis.Tests/ConnectionShutdown.cs
View file @
e4ff06f7
...
...
@@ -34,7 +34,6 @@ public async Task ShutdownRaisesConnectionFailedAndRestore()
Assert
.
Equal
(
0
,
Interlocked
.
CompareExchange
(
ref
restored
,
0
,
0
));
await
Task
.
Delay
(
1
).
ForAwait
();
// To make compiler happy in Release
#if DEBUG
conn
.
AllowConnect
=
false
;
var
server
=
conn
.
GetServer
(
TestConfig
.
Current
.
MasterServer
,
TestConfig
.
Current
.
MasterPort
);
...
...
@@ -50,7 +49,6 @@ public async Task ShutdownRaisesConnectionFailedAndRestore()
await
Task
.
Delay
(
1500
).
ForAwait
();
Assert
.
Equal
(
2
,
Interlocked
.
CompareExchange
(
ref
failed
,
0
,
0
));
Assert
.
Equal
(
2
,
Interlocked
.
CompareExchange
(
ref
restored
,
0
,
0
));
#endif
watch
.
Stop
();
}
}
...
...
StackExchange.Redis.Tests/ExceptionFactoryTests.cs
View file @
e4ff06f7
...
...
@@ -26,7 +26,7 @@ public void NullSnapshot()
var
ex
=
ExceptionFactory
.
NoConnectionAvailable
(
true
,
true
,
new
RedisCommand
(),
null
,
null
,
null
);
Assert
.
Null
(
ex
.
InnerException
);
}
#if DEBUG // needs debug connection features
[
Fact
]
public
void
MultipleEndpointsThrowConnectionException
()
{
...
...
@@ -98,6 +98,5 @@ public void ServerTakesPrecendenceOverSnapshot()
ClearAmbientFailures
();
}
}
#endif
}
}
StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
View file @
e4ff06f7
...
...
@@ -36,6 +36,15 @@ public sealed partial class ConnectionMultiplexer : IConnectionMultiplexer, IDis
}
#endif
/// <summary>
/// For debugging: when not enabled, servers cannot connect
/// </summary>
internal
volatile
bool
AllowConnect
=
true
;
/// <summary>
/// For debugging: when not enabled, end-connect is silently ignored (to simulate a long-running connect)
/// </summary>
internal
volatile
bool
IgnoreConnect
;
/// <summary>
/// Provides a way of overriding the default Task Factory. If not set, it will use the default Task.Factory.
/// Useful when top level code sets it's own factory which may interfere with Redis queries.
...
...
StackExchange.Redis/StackExchange/Redis/DebuggingAids.cs
View file @
e4ff06f7
...
...
@@ -4,43 +4,6 @@
namespace
StackExchange.Redis
{
#if DEBUG
public
partial
class
ConnectionMultiplexer
{
private
volatile
bool
allowConnect
=
true
,
ignoreConnect
=
false
;
/// <summary>
/// For debugging; when not enabled, servers cannot connect
/// </summary>
public
bool
AllowConnect
{
get
{
return
allowConnect
;
}
set
{
allowConnect
=
value
;
}
}
/// <summary>
/// For debugging; when not enabled, end-connect is silently ignored (to simulate a long-running connect)
/// </summary>
public
bool
IgnoreConnect
{
get
{
return
ignoreConnect
;
}
set
{
ignoreConnect
=
value
;
}
}
}
internal
partial
class
PhysicalConnection
{
partial
void
ShouldIgnoreConnect
(
ref
bool
ignore
)
{
ignore
=
IgnoreConnect
;
}
partial
void
OnDebugAbort
()
{
var
bridge
=
BridgeCouldBeNull
;
if
(
bridge
==
null
||
!
bridge
.
Multiplexer
.
AllowConnect
)
{
throw
new
RedisConnectionException
(
ConnectionFailureType
.
InternalFailure
,
"debugging"
);
}
}
public
bool
IgnoreConnect
=>
BridgeCouldBeNull
?.
Multiplexer
?.
IgnoreConnect
??
false
;
}
#endif
internal
static
class
PerfCounterHelper
{
private
static
readonly
object
staticLock
=
new
object
();
...
...
StackExchange.Redis/StackExchange/Redis/Interfaces/IConnectionMultiplexer.cs
View file @
e4ff06f7
...
...
@@ -11,17 +11,6 @@ namespace StackExchange.Redis
/// </summary>
public
interface
IConnectionMultiplexer
{
#if DEBUG
/// <summary>
/// For debugging; when not enabled, servers cannot connect
/// </summary>
bool
AllowConnect
{
get
;
set
;
}
/// <summary>
/// For debugging; when not enabled, end-connect is silently ignored (to simulate a long-running connect)
/// </summary>
bool
IgnoreConnect
{
get
;
set
;
}
#endif
/// <summary>
/// Gets the client-name that will be used on all new connections
/// </summary>
...
...
StackExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
View file @
e4ff06f7
...
...
@@ -116,9 +116,8 @@ internal async void BeginConnectAsync(TextWriter log)
// Complete connection
try
{
bool
ignoreConnect
=
false
;
ShouldIgnoreConnect
(
ref
ignoreConnect
);
if
(
ignoreConnect
)
return
;
// If we're told to ignore connect, abort here
if
(
BridgeCouldBeNull
?.
Multiplexer
?.
IgnoreConnect
??
false
)
return
;
await
awaitable
;
// wait for the connect to complete or fail (will throw)
if
(
timeoutSource
!=
null
)
...
...
@@ -1261,7 +1260,16 @@ private void MatchResult(RawResult result)
partial
void
OnCloseEcho
();
partial
void
OnCreateEcho
();
partial
void
OnDebugAbort
();
[
Conditional
(
"DEBUG"
)]
private
void
OnDebugAbort
()
{
var
bridge
=
BridgeCouldBeNull
;
if
(
bridge
==
null
||
!
bridge
.
Multiplexer
.
AllowConnect
)
{
throw
new
RedisConnectionException
(
ConnectionFailureType
.
InternalFailure
,
"debugging"
);
}
}
partial
void
OnWrapForLogging
(
ref
IDuplexPipe
pipe
,
string
name
,
SocketManager
mgr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment