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
2a5c4f7a
Commit
2a5c4f7a
authored
Aug 31, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optional reusable connection fixture for sharing a muxer between tests
parent
5e6f36d2
Changes
36
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
555 additions
and
89 deletions
+555
-89
ConnectionMultiplexer.cs
src/StackExchange.Redis/ConnectionMultiplexer.cs
+16
-1
IConnectionMultiplexer.cs
src/StackExchange.Redis/Interfaces/IConnectionMultiplexer.cs
+17
-6
AdhocTests.cs
tests/StackExchange.Redis.Tests/AdhocTests.cs
+2
-1
AggresssiveTests.cs
tests/StackExchange.Redis.Tests/AggresssiveTests.cs
+1
-1
BasicOps.cs
tests/StackExchange.Redis.Tests/BasicOps.cs
+31
-3
Batches.cs
tests/StackExchange.Redis.Tests/Batches.cs
+2
-1
Bits.cs
tests/StackExchange.Redis.Tests/Bits.cs
+2
-1
Constraints.cs
tests/StackExchange.Redis.Tests/Constraints.cs
+2
-1
Databases.cs
tests/StackExchange.Redis.Tests/Databases.cs
+2
-1
Execute.cs
tests/StackExchange.Redis.Tests/Execute.cs
+2
-1
Expiry.cs
tests/StackExchange.Redis.Tests/Expiry.cs
+2
-1
Failover.cs
tests/StackExchange.Redis.Tests/Failover.cs
+2
-2
FloatingPoint.cs
tests/StackExchange.Redis.Tests/FloatingPoint.cs
+2
-1
GeoTests.cs
tests/StackExchange.Redis.Tests/GeoTests.cs
+2
-1
Hashes.cs
tests/StackExchange.Redis.Tests/Hashes.cs
+2
-1
Skip.cs
tests/StackExchange.Redis.Tests/Helpers/Skip.cs
+2
-2
TestConfig.cs
tests/StackExchange.Redis.Tests/Helpers/TestConfig.cs
+1
-1
HyperLogLog.cs
tests/StackExchange.Redis.Tests/HyperLogLog.cs
+2
-1
Keys.cs
tests/StackExchange.Redis.Tests/Keys.cs
+2
-1
Lex.cs
tests/StackExchange.Redis.Tests/Lex.cs
+2
-1
Lists.cs
tests/StackExchange.Redis.Tests/Lists.cs
+2
-1
Locking.cs
tests/StackExchange.Redis.Tests/Locking.cs
+2
-2
MultiAdd.cs
tests/StackExchange.Redis.Tests/MultiAdd.cs
+2
-1
PreserveOrder.cs
tests/StackExchange.Redis.Tests/PreserveOrder.cs
+2
-1
Profiling.cs
tests/StackExchange.Redis.Tests/Profiling.cs
+4
-4
PubSub.cs
tests/StackExchange.Redis.Tests/PubSub.cs
+7
-6
PubSubCommand.cs
tests/StackExchange.Redis.Tests/PubSubCommand.cs
+2
-1
Scans.cs
tests/StackExchange.Redis.Tests/Scans.cs
+3
-2
Scripting.cs
tests/StackExchange.Redis.Tests/Scripting.cs
+6
-5
Sets.cs
tests/StackExchange.Redis.Tests/Sets.cs
+2
-1
SharedConnectionFixture.cs
tests/StackExchange.Redis.Tests/SharedConnectionFixture.cs
+340
-0
Streams.cs
tests/StackExchange.Redis.Tests/Streams.cs
+2
-1
Strings.cs
tests/StackExchange.Redis.Tests/Strings.cs
+2
-1
TestBase.cs
tests/StackExchange.Redis.Tests/TestBase.cs
+79
-32
Transactions.cs
tests/StackExchange.Redis.Tests/Transactions.cs
+2
-1
WithKeyPrefixTests.cs
tests/StackExchange.Redis.Tests/WithKeyPrefixTests.cs
+2
-1
No files found.
src/StackExchange.Redis/ConnectionMultiplexer.cs
View file @
2a5c4f7a
...
...
@@ -18,7 +18,7 @@ namespace StackExchange.Redis
/// <summary>
/// Represents an inter-related group of connections to redis servers
/// </summary>
public
sealed
partial
class
ConnectionMultiplexer
:
I
ConnectionMultiplexer
,
IDisposable
public
sealed
partial
class
ConnectionMultiplexer
:
I
InternalConnectionMultiplexer
// implies : IConnectionMultiplexer and :
IDisposable
{
private
const
string
timeoutHelpLink
=
"https://stackexchange.github.io/StackExchange.Redis/Timeouts"
;
...
...
@@ -36,10 +36,23 @@ public sealed partial class ConnectionMultiplexer : IConnectionMultiplexer, IDis
}
#endif
bool
IInternalConnectionMultiplexer
.
AllowConnect
{
get
=>
AllowConnect
;
set
=>
AllowConnect
=
value
;
}
bool
IInternalConnectionMultiplexer
.
IgnoreConnect
{
get
=>
IgnoreConnect
;
set
=>
IgnoreConnect
=
value
;
}
/// <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>
...
...
@@ -903,6 +916,8 @@ private static ConnectionMultiplexer ConnectImpl(object configuration, TextWrite
private
string
failureMessage
;
private
readonly
Hashtable
servers
=
new
Hashtable
();
private
volatile
ServerSnapshot
_serverSnapshot
=
ServerSnapshot
.
Empty
;
ReadOnlySpan
<
ServerEndPoint
>
IInternalConnectionMultiplexer
.
GetServerSnapshot
()
=>
GetServerSnapshot
();
internal
ReadOnlySpan
<
ServerEndPoint
>
GetServerSnapshot
()
=>
_serverSnapshot
.
Span
;
private
sealed
class
ServerSnapshot
{
...
...
src/StackExchange.Redis/Interfaces/IConnectionMultiplexer.cs
View file @
2a5c4f7a
...
...
@@ -6,10 +6,19 @@
namespace
StackExchange.Redis
{
internal
interface
IInternalConnectionMultiplexer
:
IConnectionMultiplexer
{
bool
AllowConnect
{
get
;
set
;
}
bool
IgnoreConnect
{
get
;
set
;
}
ReadOnlySpan
<
ServerEndPoint
>
GetServerSnapshot
();
}
/// <summary>
/// Represents the abstract multiplexer API
/// </summary>
public
interface
IConnectionMultiplexer
public
interface
IConnectionMultiplexer
:
IDisposable
{
/// <summary>
/// Gets the client-name that will be used on all new connections
...
...
@@ -220,11 +229,6 @@ public interface IConnectionMultiplexer
/// <param name="allowCommandsToComplete">Whether to allow in-queue commadns to complete first.</param>
Task
CloseAsync
(
bool
allowCommandsToComplete
=
true
);
/// <summary>
/// Release all resources associated with this object
/// </summary>
void
Dispose
();
/// <summary>
/// Obtains the log of unusual busy patterns
/// </summary>
...
...
@@ -254,5 +258,12 @@ public interface IConnectionMultiplexer
/// </summary>
/// <param name="key">The key to get a the slot for.</param>
int
GetHashSlot
(
RedisKey
key
);
/// <summary>
/// Write the configuration of all servers to an output stream
/// </summary>
/// <param name="destination">The destination stream to write the export to.</param>
/// <param name="options">The options to use for this export.</param>
void
ExportConfiguration
(
Stream
destination
,
ExportOptions
options
=
ExportOptions
.
All
);
}
}
tests/StackExchange.Redis.Tests/AdhocTests.cs
View file @
2a5c4f7a
...
...
@@ -3,9 +3,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
AdhocTests
:
TestBase
{
public
AdhocTests
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
AdhocTests
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
TestAdhocCommandsAPI
()
...
...
tests/StackExchange.Redis.Tests/AggresssiveTests.cs
View file @
2a5c4f7a
...
...
@@ -16,7 +16,7 @@ public async Task ParallelTransactionsWithConditions()
{
const
int
Muxers
=
4
,
Workers
=
20
,
PerThread
=
250
;
var
muxers
=
new
ConnectionMultiplexer
[
Muxers
];
var
muxers
=
new
I
ConnectionMultiplexer
[
Muxers
];
try
{
for
(
int
i
=
0
;
i
<
Muxers
;
i
++)
...
...
tests/StackExchange.Redis.Tests/BasicOps.cs
View file @
2a5c4f7a
using
System
;
using
System.Diagnostics
;
using
System.Threading.Tasks
;
using
StackExchange.Redis.KeyspaceIsolation
;
using
Xunit
;
using
Xunit.Abstractions
;
using
System.Diagnostics
;
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
BasicOpsTests
:
TestBase
{
public
BasicOpsTests
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
BasicOpsTests
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
async
Task
PingOnce
()
...
...
@@ -35,7 +36,7 @@ public void RapidDispose()
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
using
(
var
secondary
=
Create
(
fail
:
true
))
using
(
var
secondary
=
Create
(
fail
:
true
,
shared
:
false
))
{
secondary
.
GetDatabase
().
StringIncrement
(
key
,
flags
:
CommandFlags
.
FireAndForget
);
}
...
...
@@ -398,6 +399,33 @@ private void Incr(IDatabase database, RedisKey key, int delta, ref int total)
total
+=
delta
;
}
[
Fact
]
public
void
ShouldUseSharedMuxer
()
{
if
(
SharedFixtureAvailable
)
{
using
(
var
a
=
Create
())
{
Assert
.
IsNotType
<
ConnectionMultiplexer
>(
a
);
using
(
var
b
=
Create
())
{
Assert
.
Same
(
a
,
b
);
}
}
}
else
{
using
(
var
a
=
Create
())
{
Assert
.
IsType
<
ConnectionMultiplexer
>(
a
);
using
(
var
b
=
Create
())
{
Assert
.
NotSame
(
a
,
b
);
}
}
}
}
[
Fact
]
public
async
Task
Delete
()
{
...
...
tests/StackExchange.Redis.Tests/Batches.cs
View file @
2a5c4f7a
...
...
@@ -6,9 +6,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Batches
:
TestBase
{
public
Batches
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Batches
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
TestBatchNotSent
()
...
...
tests/StackExchange.Redis.Tests/Bits.cs
View file @
2a5c4f7a
...
...
@@ -3,9 +3,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Bits
:
TestBase
{
public
Bits
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Bits
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
BasicOps
()
...
...
tests/StackExchange.Redis.Tests/Constraints.cs
View file @
2a5c4f7a
...
...
@@ -4,9 +4,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Constraints
:
TestBase
{
public
Constraints
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Constraints
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
ValueEquals
()
...
...
tests/StackExchange.Redis.Tests/Databases.cs
View file @
2a5c4f7a
...
...
@@ -4,9 +4,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Databases
:
TestBase
{
public
Databases
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Databases
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
async
Task
CountKeys
()
...
...
tests/StackExchange.Redis.Tests/Execute.cs
View file @
2a5c4f7a
...
...
@@ -5,9 +5,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
ExecuteTests
:
TestBase
{
public
ExecuteTests
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
ExecuteTests
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
async
Task
DBExecute
()
...
...
tests/StackExchange.Redis.Tests/Expiry.cs
View file @
2a5c4f7a
...
...
@@ -5,9 +5,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Expiry
:
TestBase
{
public
Expiry
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Expiry
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
private
static
string
[]
GetMap
(
bool
disablePTimes
)
=>
disablePTimes
?
(
new
[]
{
"pexpire"
,
"pexpireat"
,
"pttl"
})
:
null
;
...
...
tests/StackExchange.Redis.Tests/Failover.cs
View file @
2a5c4f7a
...
...
@@ -199,8 +199,8 @@ public async Task SubscriptionsSurviveMasterSwitchAsync()
Skip
.
Inconclusive
(
"TODO: Fix race in broadcast reconfig a zero latency."
);
}
using
(
var
a
=
Create
(
allowAdmin
:
true
))
using
(
var
b
=
Create
(
allowAdmin
:
true
))
using
(
var
a
=
Create
(
allowAdmin
:
true
,
shared
:
false
))
using
(
var
b
=
Create
(
allowAdmin
:
true
,
shared
:
false
))
{
RedisChannel
channel
=
Me
();
var
subA
=
a
.
GetSubscriber
();
...
...
tests/StackExchange.Redis.Tests/FloatingPoint.cs
View file @
2a5c4f7a
...
...
@@ -5,9 +5,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
FloatingPoint
:
TestBase
{
public
FloatingPoint
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
FloatingPoint
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
private
static
bool
Within
(
double
x
,
double
y
,
double
delta
)
{
...
...
tests/StackExchange.Redis.Tests/GeoTests.cs
View file @
2a5c4f7a
...
...
@@ -5,9 +5,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
GeoTests
:
TestBase
{
public
GeoTests
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
GeoTests
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
public
static
GeoEntry
palermo
=
new
GeoEntry
(
13.361389
,
38.115556
,
"Palermo"
),
...
...
tests/StackExchange.Redis.Tests/Hashes.cs
View file @
2a5c4f7a
...
...
@@ -9,9 +9,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Hashes
:
TestBase
// https://redis.io/commands#hash
{
public
Hashes
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Hashes
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
async
Task
TestIncrBy
()
...
...
tests/StackExchange.Redis.Tests/Helpers/Skip.cs
View file @
2a5c4f7a
...
...
@@ -23,7 +23,7 @@ public static void IfNoConfig(string prop, List<string> values)
}
}
public
static
void
IfMissingFeature
(
ConnectionMultiplexer
conn
,
string
feature
,
Func
<
RedisFeatures
,
bool
>
check
)
public
static
void
IfMissingFeature
(
I
ConnectionMultiplexer
conn
,
string
feature
,
Func
<
RedisFeatures
,
bool
>
check
)
{
var
features
=
conn
.
GetServer
(
conn
.
GetEndPoints
()[
0
]).
Features
;
if
(!
check
(
features
))
...
...
@@ -35,7 +35,7 @@ public static void IfMissingFeature(ConnectionMultiplexer conn, string feature,
}
}
internal
static
void
IfMissingDatabase
(
ConnectionMultiplexer
conn
,
int
dbId
)
internal
static
void
IfMissingDatabase
(
I
ConnectionMultiplexer
conn
,
int
dbId
)
{
var
dbCount
=
conn
.
GetServer
(
conn
.
GetEndPoints
()[
0
]).
DatabaseCount
;
if
(
dbId
>=
dbCount
)
throw
new
SkipTestException
(
$"Database '
{
dbId
}
' is not supported on this server."
);
...
...
tests/StackExchange.Redis.Tests/Helpers/TestConfig.cs
View file @
2a5c4f7a
...
...
@@ -12,7 +12,7 @@ public static class TestConfig
public
static
Config
Current
{
get
;
}
private
static
int
_db
=
17
;
public
static
int
GetDedicatedDB
(
ConnectionMultiplexer
conn
=
null
)
public
static
int
GetDedicatedDB
(
I
ConnectionMultiplexer
conn
=
null
)
{
int
db
=
Interlocked
.
Increment
(
ref
_db
);
if
(
conn
!=
null
)
Skip
.
IfMissingDatabase
(
conn
,
db
);
...
...
tests/StackExchange.Redis.Tests/HyperLogLog.cs
View file @
2a5c4f7a
...
...
@@ -3,9 +3,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
HyperLogLog
:
TestBase
{
public
HyperLogLog
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
HyperLogLog
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
SingleKeyLength
()
...
...
tests/StackExchange.Redis.Tests/Keys.cs
View file @
2a5c4f7a
...
...
@@ -7,9 +7,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Keys
:
TestBase
{
public
Keys
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Keys
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
TestScan
()
...
...
tests/StackExchange.Redis.Tests/Lex.cs
View file @
2a5c4f7a
...
...
@@ -3,9 +3,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Lex
:
TestBase
{
public
Lex
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Lex
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
QueryRangeAndLengthByLex
()
...
...
tests/StackExchange.Redis.Tests/Lists.cs
View file @
2a5c4f7a
...
...
@@ -4,9 +4,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Lists
:
TestBase
{
public
Lists
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Lists
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
Ranges
()
...
...
tests/StackExchange.Redis.Tests/Locking.cs
View file @
2a5c4f7a
...
...
@@ -76,7 +76,7 @@ public void TestOpCountByVersionLocal_UpLevel()
}
}
private
void
TestLockOpCountByVersion
(
ConnectionMultiplexer
conn
,
int
expectedOps
,
bool
existFirst
)
private
void
TestLockOpCountByVersion
(
I
ConnectionMultiplexer
conn
,
int
expectedOps
,
bool
existFirst
)
{
const
int
LockDuration
=
30
;
RedisKey
Key
=
Me
();
...
...
@@ -103,7 +103,7 @@ private void TestLockOpCountByVersion(ConnectionMultiplexer conn, int expectedOp
// note we get a ping from GetCounters
}
private
ConnectionMultiplexer
Create
(
TestMode
mode
)
private
I
ConnectionMultiplexer
Create
(
TestMode
mode
)
{
switch
(
mode
)
{
...
...
tests/StackExchange.Redis.Tests/MultiAdd.cs
View file @
2a5c4f7a
...
...
@@ -4,9 +4,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
MultiAdd
:
TestBase
{
public
MultiAdd
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
MultiAdd
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
AddSortedSetEveryWay
()
...
...
tests/StackExchange.Redis.Tests/PreserveOrder.cs
View file @
2a5c4f7a
...
...
@@ -7,9 +7,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
PreserveOrder
:
TestBase
{
public
PreserveOrder
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
PreserveOrder
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
Execute
()
...
...
tests/StackExchange.Redis.Tests/Profiling.cs
View file @
2a5c4f7a
...
...
@@ -73,7 +73,7 @@ public void Simple()
}
}
private
static
void
AssertProfiledCommandValues
(
IProfiledCommand
command
,
ConnectionMultiplexer
conn
,
int
dbId
)
private
static
void
AssertProfiledCommandValues
(
IProfiledCommand
command
,
I
ConnectionMultiplexer
conn
,
int
dbId
)
{
Assert
.
Equal
(
dbId
,
command
.
Db
);
Assert
.
Equal
(
conn
.
GetEndPoints
()[
0
],
command
.
EndPoint
);
...
...
@@ -275,7 +275,7 @@ public void ProfilingMD_Ex1()
{
using
(
var
c
=
Create
())
{
ConnectionMultiplexer
conn
=
c
;
I
ConnectionMultiplexer
conn
=
c
;
var
session
=
new
ProfilingSession
();
var
prefix
=
Me
();
...
...
@@ -317,7 +317,7 @@ public void ProfilingMD_Ex2()
{
using
(
var
c
=
Create
())
{
ConnectionMultiplexer
conn
=
c
;
I
ConnectionMultiplexer
conn
=
c
;
var
profiler
=
new
PerThreadProfiler
();
var
prefix
=
Me
();
...
...
@@ -362,7 +362,7 @@ public async Task ProfilingMD_Ex2_Async()
{
using
(
var
c
=
Create
())
{
ConnectionMultiplexer
conn
=
c
;
I
ConnectionMultiplexer
conn
=
c
;
var
profiler
=
new
AsyncLocalProfiler
();
var
prefix
=
Me
();
...
...
tests/StackExchange.Redis.Tests/PubSub.cs
View file @
2a5c4f7a
...
...
@@ -10,9 +10,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
PubSub
:
TestBase
{
public
PubSub
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
PubSub
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
async
Task
ExplicitPublishMode
()
...
...
@@ -172,7 +173,7 @@ public async Task TestBasicPubSubFireAndForget()
}
}
private
static
async
Task
PingAsync
(
ConnectionMultiplexer
muxer
,
IServer
pub
,
ISubscriber
sub
,
int
times
=
1
)
private
static
async
Task
PingAsync
(
I
ConnectionMultiplexer
muxer
,
IServer
pub
,
ISubscriber
sub
,
int
times
=
1
)
{
while
(
times
--
>
0
)
{
...
...
@@ -558,8 +559,8 @@ public async Task PubSubGetAllCorrectOrder_OnMessage_Async()
public
async
Task
TestPublishWithSubscribers
()
{
var
channel
=
Me
();
using
(
var
muxerA
=
Create
())
using
(
var
muxerB
=
Create
())
using
(
var
muxerA
=
Create
(
shared
:
false
))
using
(
var
muxerB
=
Create
(
shared
:
false
))
using
(
var
conn
=
Create
())
{
var
listenA
=
muxerA
.
GetSubscriber
();
...
...
@@ -578,8 +579,8 @@ public async Task TestPublishWithSubscribers()
public
async
Task
TestMultipleSubscribersGetMessage
()
{
var
channel
=
Me
();
using
(
var
muxerA
=
Create
())
using
(
var
muxerB
=
Create
())
using
(
var
muxerA
=
Create
(
shared
:
false
))
using
(
var
muxerB
=
Create
(
shared
:
false
))
using
(
var
conn
=
Create
())
{
var
listenA
=
muxerA
.
GetSubscriber
();
...
...
tests/StackExchange.Redis.Tests/PubSubCommand.cs
View file @
2a5c4f7a
...
...
@@ -4,9 +4,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
PubSubCommand
:
TestBase
{
public
PubSubCommand
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
PubSubCommand
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
SubscriberCount
()
...
...
tests/StackExchange.Redis.Tests/Scans.cs
View file @
2a5c4f7a
...
...
@@ -6,9 +6,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Scans
:
TestBase
{
public
Scans
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Scans
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Theory
]
[
InlineData
(
true
)]
...
...
@@ -339,7 +340,7 @@ public void HashScanThresholds()
}
}
private
bool
GotCursors
(
ConnectionMultiplexer
conn
,
RedisKey
key
,
int
count
)
private
bool
GotCursors
(
I
ConnectionMultiplexer
conn
,
RedisKey
key
,
int
count
)
{
var
db
=
conn
.
GetDatabase
();
db
.
KeyDelete
(
key
,
CommandFlags
.
FireAndForget
);
...
...
tests/StackExchange.Redis.Tests/Scripting.cs
View file @
2a5c4f7a
...
...
@@ -8,11 +8,12 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Scripting
:
TestBase
{
public
Scripting
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Scripting
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
private
ConnectionMultiplexer
GetScriptConn
(
bool
allowAdmin
=
false
)
private
I
ConnectionMultiplexer
GetScriptConn
(
bool
allowAdmin
=
false
)
{
int
syncTimeout
=
5000
;
if
(
Debugger
.
IsAttached
)
syncTimeout
=
500000
;
...
...
@@ -596,7 +597,7 @@ public void LuaScriptWithKeys()
var
p
=
new
{
key
=
(
RedisKey
)
key
,
value
=
123
};
script
.
Evaluate
(
db
,
p
,
flags
:
CommandFlags
.
FireAndForget
);
script
.
Evaluate
(
db
,
p
);
var
val
=
db
.
StringGet
(
key
);
Assert
.
Equal
(
123
,
(
int
)
val
);
...
...
@@ -804,7 +805,7 @@ public void IServerLuaScriptConvenienceMethods()
var
prepared
=
server
.
ScriptLoad
(
script
);
db
.
ScriptEvaluate
(
prepared
,
new
{
key
=
(
RedisKey
)
key
,
value
=
"value3"
}
,
flags
:
CommandFlags
.
FireAndForget
);
db
.
ScriptEvaluate
(
prepared
,
new
{
key
=
(
RedisKey
)
key
,
value
=
"value3"
});
var
val
=
db
.
StringGet
(
key
);
Assert
.
Equal
(
"value3"
,
val
);
}
...
...
@@ -842,7 +843,7 @@ public void LuaScriptWithWrappedDatabase()
db
.
KeyDelete
(
key
,
CommandFlags
.
FireAndForget
);
var
prepared
=
LuaScript
.
Prepare
(
Script
);
wrappedDb
.
ScriptEvaluate
(
prepared
,
new
{
key
=
(
RedisKey
)
key
,
value
=
123
}
,
flags
:
CommandFlags
.
FireAndForget
);
wrappedDb
.
ScriptEvaluate
(
prepared
,
new
{
key
=
(
RedisKey
)
key
,
value
=
123
});
var
val1
=
wrappedDb
.
StringGet
(
key
);
Assert
.
Equal
(
123
,
(
int
)
val1
);
...
...
tests/StackExchange.Redis.Tests/Sets.cs
View file @
2a5c4f7a
...
...
@@ -6,9 +6,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Sets
:
TestBase
{
public
Sets
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Sets
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
SScan
()
...
...
tests/StackExchange.Redis.Tests/SharedConnectionFixture.cs
0 → 100644
View file @
2a5c4f7a
This diff is collapsed.
Click to expand it.
tests/StackExchange.Redis.Tests/Streams.cs
View file @
2a5c4f7a
...
...
@@ -6,9 +6,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Streams
:
TestBase
{
public
Streams
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Streams
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
IsStreamType
()
...
...
tests/StackExchange.Redis.Tests/Strings.cs
View file @
2a5c4f7a
...
...
@@ -7,9 +7,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Strings
:
TestBase
// https://redis.io/commands#string
{
public
Strings
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Strings
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
async
Task
Append
()
...
...
tests/StackExchange.Redis.Tests/TestBase.cs
View file @
2a5c4f7a
This diff is collapsed.
Click to expand it.
tests/StackExchange.Redis.Tests/Transactions.cs
View file @
2a5c4f7a
...
...
@@ -10,9 +10,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
Transactions
:
TestBase
{
public
Transactions
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
Transactions
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
BasicEmptyTran
()
...
...
tests/StackExchange.Redis.Tests/WithKeyPrefixTests.cs
View file @
2a5c4f7a
...
...
@@ -5,9 +5,10 @@
namespace
StackExchange.Redis.Tests
{
[
Collection
(
SharedConnectionFixture
.
Key
)]
public
class
WithKeyPrefixTests
:
TestBase
{
public
WithKeyPrefixTests
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
WithKeyPrefixTests
(
ITestOutputHelper
output
,
SharedConnectionFixture
fixture
)
:
base
(
output
,
fixture
)
{
}
[
Fact
]
public
void
BlankPrefixYieldsSame_Bytes
()
...
...
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