Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compatibility] Added ZRANGESTORE command #826

Merged
merged 15 commits into from
Dec 8, 2024
Merged
Prev Previous commit
Next Next commit
Slot Test
  • Loading branch information
Vijay-Nirmal committed Nov 25, 2024
commit 1d8216fec3ef52b20f136f9637dbe4ed208a2dce
29 changes: 29 additions & 0 deletions test/Garnet.test.cluster/RedirectTests/BaseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1921,6 +1921,35 @@ public override ArraySegment<string>[] SetupSingleSlotRequest()
}
}

internal class ZRANGESTORE : BaseCommand
{
public override bool IsArrayCommand => true;
public override bool ArrayResponse => false;
public override string Command => nameof(ZRANGESTORE);

public override string[] GetSingleSlotRequest()
{
var ssk = GetSingleSlotKeys;
// ZRANGESTORE dst src 0 -1
return [ssk[0], ssk[1], "0", "-1"];
}

public override string[] GetCrossSlotRequest()
{
var csk = GetCrossSlotKeys;
return [csk[0], csk[1], "0", "-1"];
}

public override ArraySegment<string>[] SetupSingleSlotRequest()
{
var ssk = GetSingleSlotKeys;
var setup = new ArraySegment<string>[2];
setup[0] = new(["ZADD", ssk[1], "1", "a", "2", "b", "3", "c"]);
setup[1] = new(["ZADD", ssk[2], "4", "d", "5", "e", "6", "f"]);
return setup;
}
}

#endregion

#region HashCommands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public class ClusterSlotVerificationTests
new ZREM(),
new ZCARD(),
new ZRANGE(),
new ZRANGESTORE(),
new ZSCORE(),
new ZMSCORE(),
new ZPOPMAX(),
Expand Down Expand Up @@ -274,6 +275,7 @@ public virtual void OneTimeTearDown()
[TestCase("ZREM")]
[TestCase("ZCARD")]
[TestCase("ZRANGE")]
[TestCase("ZRANGESTORE")]
[TestCase("ZSCORE")]
[TestCase("ZMSCORE")]
[TestCase("ZPOPMAX")]
Expand Down Expand Up @@ -413,6 +415,7 @@ void GarnetClientSessionClusterDown(BaseCommand command)
[TestCase("ZREM")]
[TestCase("ZCARD")]
[TestCase("ZRANGE")]
[TestCase("ZRANGESTORE")]
[TestCase("ZSCORE")]
[TestCase("ZMSCORE")]
[TestCase("ZPOPMAX")]
Expand Down Expand Up @@ -562,6 +565,7 @@ void GarnetClientSessionOK(BaseCommand command)
[TestCase("ZREM")]
[TestCase("ZCARD")]
[TestCase("ZRANGE")]
[TestCase("ZRANGESTORE")]
[TestCase("ZSCORE")]
[TestCase("ZMSCORE")]
[TestCase("ZPOPMAX")]
Expand Down Expand Up @@ -703,6 +707,7 @@ void GarnetClientSessionCrossslotTest(BaseCommand command)
[TestCase("ZREM")]
[TestCase("ZCARD")]
[TestCase("ZRANGE")]
[TestCase("ZRANGESTORE")]
[TestCase("ZSCORE")]
[TestCase("ZMSCORE")]
[TestCase("ZPOPMAX")]
Expand Down Expand Up @@ -851,6 +856,7 @@ void GarnetClientSessionMOVEDTest(BaseCommand command)
[TestCase("ZREM")]
[TestCase("ZCARD")]
[TestCase("ZRANGE")]
[TestCase("ZRANGESTORE")]
[TestCase("ZSCORE")]
[TestCase("ZMSCORE")]
[TestCase("ZPOPMAX")]
Expand Down Expand Up @@ -1016,6 +1022,7 @@ void GarnetClientSessionASKTest(BaseCommand command)
[TestCase("ZREM")]
[TestCase("ZCARD")]
[TestCase("ZRANGE")]
[TestCase("ZRANGESTORE")]
[TestCase("ZSCORE")]
[TestCase("ZMSCORE")]
[TestCase("ZPOPMAX")]
Expand Down