Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.17.0" />
<PackageVersion Include="Microsoft.IdentityModel.Validators" Version="8.17.0" />
<PackageVersion Include="StackExchange.Redis" Version="2.12.8" />
<PackageVersion Include="StackExchange.Redis" Version="3.2.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.17.0" />
<PackageVersion Include="System.Interactive.Async" Version="6.0.1" />
<PackageVersion Include="System.Text.Json" Version="10.0.5" />
Expand Down
46 changes: 23 additions & 23 deletions test/cluster/Garnet.test.cluster.migrate/ClusterMigrateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ public void ClusterSimpleMigrateSlotsExpiry()

try
{
var result = (string)server.Execute("zadd", args);
var result = (string)server.Execute(0, "zadd", args);
data.Sort((x, y) => x.Item1.CompareTo(y.Item1));
return (result, data);
}
Expand All @@ -672,7 +672,7 @@ private string DoZCOUNT(int nodeIndex, byte[] key, out int count, out string add

try
{
var result = server.Execute("zcount", args, CommandFlags.NoRedirect);
var result = server.Execute(0, "zcount", args, CommandFlags.NoRedirect);
count = int.Parse((string)result);
address = ((IPEndPoint)server.EndPoint).Address.ToString();
port = ((IPEndPoint)server.EndPoint).Port;
Expand Down Expand Up @@ -725,7 +725,7 @@ private string DoZCOUNT(int nodeIndex, byte[] key, out int count, out string add
];
try
{
var result = server.Execute("zrange", args, CommandFlags.NoRedirect);
var result = server.Execute(0, "zrange", args, CommandFlags.NoRedirect);
address = ((IPEndPoint)server.EndPoint).Address.ToString();
port = ((IPEndPoint)server.EndPoint).Port;
slot = ClusterTestUtils.HashSlot(key);
Expand Down Expand Up @@ -2183,9 +2183,9 @@ public void ClusterMigrateSetCopyUpdate(CancellationToken cancellationToken)

foreach (var value in values)
{
var result = (string)sourceServer.Execute("set", key, value);
var result = (string)sourceServer.Execute(0, "set", [key, value]);
ClassicAssert.AreEqual("OK", result);
result = (string)sourceServer.Execute("get", key);
result = (string)sourceServer.Execute(0, "get", [key]);
ClassicAssert.AreEqual(Encoding.ASCII.GetString(value), result);
}

Expand All @@ -2204,9 +2204,9 @@ public void ClusterMigrateSetCopyUpdate(CancellationToken cancellationToken)
values = context.GenerateIncreasingSizeValues(6, 7);
foreach (var value in values)
{
var result = (string)sourceServer.Execute("set", key, value);
var result = (string)sourceServer.Execute(0, "set", [key, value]);
ClassicAssert.AreEqual("OK", result);
result = (string)sourceServer.Execute("get", key);
result = (string)sourceServer.Execute(0, "get", [key]);
ClassicAssert.AreEqual(Encoding.ASCII.GetString(value), result);
}

Expand All @@ -2223,7 +2223,7 @@ public void ClusterMigrateSetCopyUpdate(CancellationToken cancellationToken)

foreach (var value in values)
{
var result = (string)targetServer.Execute("get", key);
var result = (string)targetServer.Execute(0, "get", [key]);
ClassicAssert.AreEqual(Encoding.ASCII.GetString(value), result);
}
}
Expand Down Expand Up @@ -2255,9 +2255,9 @@ public void ClusterMigrateCustomProcDelRMW(CancellationToken cancellationToken)
var value = "12345";
var value2 = "67890";
var slot = HashSlotUtils.HashSlot(Encoding.ASCII.GetBytes(key));
var resp = sourceServer.Execute("set", key, value);
var resp = sourceServer.Execute(0, "set", [key, value]);
ClassicAssert.AreEqual("OK", (string)resp);
resp = sourceServer.Execute("get", key);
resp = sourceServer.Execute(0, "get", [key]);
ClassicAssert.AreEqual(value, (string)resp);

try
Expand All @@ -2273,7 +2273,7 @@ public void ClusterMigrateCustomProcDelRMW(CancellationToken cancellationToken)
}

// At this point we should have switched to MIGRATING state but not yet started migration, hence we can still operate on the key
_ = sourceServer.Execute("DELRMW", [key, value2]);
_ = sourceServer.Execute(0, "DELRMW", [key, value2]);

// Re-enable to signal migration to continue
ExceptionInjectionHelper.EnableException(ExceptionInjectionType.Migration_Slot_End_Scan_Range_Acquisition);
Expand All @@ -2286,7 +2286,7 @@ public void ClusterMigrateCustomProcDelRMW(CancellationToken cancellationToken)
ExceptionInjectionHelper.DisableException(ExceptionInjectionType.Migration_Slot_End_Scan_Range_Acquisition);
}

resp = targetServer.Execute("get", key);
resp = targetServer.Execute(0, "get", [key]);
ClassicAssert.AreEqual(value2, (string)resp);
}
#endif
Expand Down Expand Up @@ -2337,7 +2337,7 @@ public void ClusterMigrateSlotsWithHostname()

try
{
var resp = server.Execute("migrate", args);
var resp = server.Execute(0, "migrate", args);
ClassicAssert.AreEqual("OK", (string)resp);
}
catch (Exception ex)
Expand Down Expand Up @@ -2405,7 +2405,7 @@ public void ClusterMigrateWithInvalidHostname()

try
{
var resp = server.Execute("migrate", args);
var resp = server.Execute(0, "migrate", args);
Assert.Fail($"Migration with invalid hostname '{invalidHostname}' should fail");
}
catch (RedisServerException ex)
Expand Down Expand Up @@ -2595,10 +2595,10 @@ public void ClusterDelKeysInSlotRemovesStringAndObjectKeys()
context.clusterTestUtils.RandomBytesRestrictedToSlot(ref keepObjectKey, keepSlot);

var server = context.clusterTestUtils.GetServer(0);
_ = server.Execute("SET", delStringKey, "raw-del");
_ = server.Execute("SADD", delObjectKey, "del-m1", "del-m2", "del-m3");
_ = server.Execute("SET", keepStringKey, "raw-keep");
_ = server.Execute("SADD", keepObjectKey, "keep-m1", "keep-m2", "keep-m3");
_ = server.Execute(0, "SET", [delStringKey, "raw-del"]);
_ = server.Execute(0, "SADD", [delObjectKey, "del-m1", "del-m2", "del-m3"]);
_ = server.Execute(0, "SET", [keepStringKey, "raw-keep"]);
_ = server.Execute(0, "SADD", [keepObjectKey, "keep-m1", "keep-m2", "keep-m3"]);

// Both slots should each contain their two keys before deletion.
ClassicAssert.AreEqual(2, context.clusterTestUtils.CountKeysInSlot(0, delSlot, context.logger),
Expand All @@ -2620,17 +2620,17 @@ public void ClusterDelKeysInSlotRemovesStringAndObjectKeys()
"Keys in keepSlot must NOT be collateral-deleted by DELKEYSINSLOT on delSlot");

// Direct GET / EXISTS confirm the delSlot keys are gone.
var delStringRes = server.Execute("GET", delStringKey);
var delStringRes = server.Execute(0, "GET", [delStringKey]);
ClassicAssert.IsTrue(delStringRes.IsNull, "delSlot string key should no longer exist after DELKEYSINSLOT");
var delObjectRes = (long)server.Execute("EXISTS", delObjectKey);
var delObjectRes = (long)server.Execute(0, "EXISTS", [delObjectKey]);
ClassicAssert.AreEqual(0, delObjectRes, "delSlot object key should no longer exist after DELKEYSINSLOT");

// Direct GET / EXISTS confirm the keepSlot keys still exist with their original payloads.
var keepStringRes = (string)server.Execute("GET", keepStringKey);
var keepStringRes = (string)server.Execute(0, "GET", [keepStringKey]);
ClassicAssert.AreEqual("raw-keep", keepStringRes, "keepSlot string key value should be unchanged");
var keepObjectExists = (long)server.Execute("EXISTS", keepObjectKey);
var keepObjectExists = (long)server.Execute(0, "EXISTS", [keepObjectKey]);
ClassicAssert.AreEqual(1, keepObjectExists, "keepSlot object key should still exist after DELKEYSINSLOT");
var keepObjectCard = (long)server.Execute("SCARD", keepObjectKey);
var keepObjectCard = (long)server.Execute(0, "SCARD", [keepObjectKey]);
ClassicAssert.AreEqual(3, keepObjectCard, "keepSlot object key should still contain all 3 members");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public void ClusterCLUSTERDOWNTest()
void SERedisClusterDown(BaseCommand command)
{
AssertSlotsNotAssigned(requestNodeIndex);
var ex = Assert.Throws<RedisServerException>(() => context.clusterTestUtils.GetServer(requestNodeIndex).Execute(command.Command, command.GetSingleSlotRequest()),
var ex = Assert.Throws<RedisServerException>(() => context.clusterTestUtils.GetServer(requestNodeIndex).Execute(0, command.Command, command.GetSingleSlotRequest()),
$"Expected exception was not thrown. Command: {command.Command} \n{ClusterState()}");
ClassicAssert.AreEqual("CLUSTERDOWN Hash slot not served", ex.Message, command.Command);
}
Expand Down Expand Up @@ -353,7 +353,7 @@ public void ClusterOKTest()

try
{
var resp = (string)context.clusterTestUtils.GetServer(requestNodeIndex).Execute("DEL", [.. command.GetSingleSlotKeys], CommandFlags.NoRedirect);
var resp = (string)context.clusterTestUtils.GetServer(requestNodeIndex).Execute(0, "DEL", [.. command.GetSingleSlotKeys], CommandFlags.NoRedirect);
}
catch (Exception ex)
{
Expand All @@ -367,11 +367,11 @@ void SERedisOKTest(BaseCommand command)
{
if (command.RequiresObjectParameters)
{
_ = context.clusterTestUtils.GetServer(requestNodeIndex).Execute(command.Command, command.GetSingleSlotObjectRequest());
_ = context.clusterTestUtils.GetServer(requestNodeIndex).Execute(0, command.Command, command.GetSingleSlotObjectRequest());
}
else
{
_ = context.clusterTestUtils.GetServer(requestNodeIndex).Execute(command.Command, command.GetSingleSlotRequest());
_ = context.clusterTestUtils.GetServer(requestNodeIndex).Execute(0, command.Command, command.GetSingleSlotRequest());
}
}
catch (Exception ex)
Expand Down Expand Up @@ -423,7 +423,7 @@ void SERedisCrossslotTest(BaseCommand command)
{
if (!command.IsArrayCommand)
return;
var ex = Assert.Throws<RedisServerException>(() => context.clusterTestUtils.GetServer(requestNodeIndex).Execute(command.Command, command.GetCrossSlotRequest()),
var ex = Assert.Throws<RedisServerException>(() => context.clusterTestUtils.GetServer(requestNodeIndex).Execute(0, command.Command, command.GetCrossSlotRequest()),
$"Expected exception was not thrown. Command: {command.Command} \n{ClusterState()}");
ClassicAssert.AreEqual("CROSSSLOT Keys in request do not hash to the same slot", ex.Message, command.Command);
}
Expand Down Expand Up @@ -460,7 +460,7 @@ public void ClusterMOVEDTest()

void SERedisMOVEDTest(BaseCommand command)
{
var ex = Assert.Throws<RedisServerException>(() => context.clusterTestUtils.GetServer(requestNodeIndex).Execute(command.Command, command.GetSingleSlotRequest(), CommandFlags.NoRedirect),
var ex = Assert.Throws<RedisServerException>(() => context.clusterTestUtils.GetServer(requestNodeIndex).Execute(0, command.Command, command.GetSingleSlotRequest(), CommandFlags.NoRedirect),
$"Expected exception was not thrown. Command: {command.Command} \n{ClusterState()}");
ClassicAssert.IsTrue(ex.Message.StartsWith("Key has MOVED"), command.Command);
var tokens = ex.Message.Split(' ');
Expand Down Expand Up @@ -511,7 +511,7 @@ public void ClusterASKTest()
ResetSlot();
try
{
var resp = (string)context.clusterTestUtils.GetServer(requestNodeIndex).Execute("DEL", [.. command.GetSingleSlotKeys], CommandFlags.NoRedirect);
var resp = (string)context.clusterTestUtils.GetServer(requestNodeIndex).Execute(0, "DEL", [.. command.GetSingleSlotKeys], CommandFlags.NoRedirect);
}
catch (Exception ex)
{
Expand All @@ -522,7 +522,7 @@ public void ClusterASKTest()

void SERedisASKTest(BaseCommand command)
{
var ex = Assert.Throws<RedisConnectionException>(() => context.clusterTestUtils.GetServer(requestNodeIndex).Execute(command.Command, command.GetSingleSlotRequest(), CommandFlags.NoRedirect),
var ex = Assert.Throws<RedisConnectionException>(() => context.clusterTestUtils.GetServer(requestNodeIndex).Execute(0, command.Command, command.GetSingleSlotRequest(), CommandFlags.NoRedirect),
$"Expected exception was not thrown. Command: {command.Command} \n{ClusterState()}");
var tokens = ex.Message.Split(' ');
ClassicAssert.IsTrue(tokens.Length > 10 && tokens[0].Equals("Endpoint"), command.Command + " => " + ex.Message);
Expand Down Expand Up @@ -568,7 +568,7 @@ void SERedisTRYAGAINTest(BaseCommand command)
var setupParameters = setup.Slice(1).ToArray();
try
{
_ = context.clusterTestUtils.GetServer(requestNodeIndex).Execute(setup[0], setupParameters, CommandFlags.NoRedirect);
_ = context.clusterTestUtils.GetServer(requestNodeIndex).Execute(0, setup[0], setupParameters, CommandFlags.NoRedirect);
}
catch (Exception ex)
{
Expand All @@ -580,7 +580,7 @@ void SERedisTRYAGAINTest(BaseCommand command)
ConfigureSlotForMigration();
try
{
var ex = Assert.Throws<RedisServerException>(() => context.clusterTestUtils.GetServer(requestNodeIndex).Execute(command.Command, command.GetSingleSlotRequest(), CommandFlags.NoRedirect),
var ex = Assert.Throws<RedisServerException>(() => context.clusterTestUtils.GetServer(requestNodeIndex).Execute(0, command.Command, command.GetSingleSlotRequest(), CommandFlags.NoRedirect),
$"Expected exception was not thrown. Command: {command.Command} \n{ClusterState()}");
ClassicAssert.AreEqual("TRYAGAIN Multiple keys request during rehashing of slot", ex.Message, command.Command, $"\n{ClusterState()}");
}
Expand All @@ -589,7 +589,7 @@ void SERedisTRYAGAINTest(BaseCommand command)
ResetSlot();
try
{
_ = context.clusterTestUtils.GetServer(requestNodeIndex).Execute("DEL", [.. command.GetSingleSlotKeys], CommandFlags.NoRedirect);
_ = context.clusterTestUtils.GetServer(requestNodeIndex).Execute(0, "DEL", [.. command.GetSingleSlotKeys], CommandFlags.NoRedirect);
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public async Task ClusterReplicationShardedLogRecoverAsync()
context.PopulatePrimary(ref context.kvPairs, keyLength, kvpairCount, 0);

var primaryServer = context.clusterTestUtils.GetServer(primaryNodeIndex);
var expectedKeys = (string[])primaryServer.Execute("KEYS", ["*"]);
var expectedKeys = (string[])primaryServer.Execute(0, "KEYS", ["*"]);
await context.nodes[primaryNodeIndex].Store.CommitAOFAsync(default).ConfigureAwait(false);

// Shutdown node
Expand All @@ -220,7 +220,7 @@ public async Task ClusterReplicationShardedLogRecoverAsync()
context.CreateConnection(useTLS: useTLS);

primaryServer = context.clusterTestUtils.GetServer(primaryNodeIndex);
var keys = (string[])primaryServer.Execute("KEYS", ["*"]);
var keys = (string[])primaryServer.Execute(0, "KEYS", ["*"]);
Array.Sort(keys);
Array.Sort(expectedKeys);
ClassicAssert.AreEqual(expectedKeys.Length, keys.Length);
Expand Down
Loading
Loading