Skip to content

Commit

Permalink
fix RestoreACLsAsync test
Browse files Browse the repository at this point in the history
  • Loading branch information
s3w3nofficial committed Jan 16, 2025
1 parent 737e7a9 commit eed596f
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions test/Garnet.test/Resp/ACL/RespCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Garnet.client;
using Garnet.server;
Expand Down Expand Up @@ -6415,12 +6416,14 @@ static async Task DoDUMPAsync(GarnetClient client)
[Test]
public async Task RestoreACLsAsync()
{
var count = 0;

await CheckCommandsAsync(
"RESTORE",
[DoRestoreAsync]
);

static async Task DoRestoreAsync(GarnetClient client)
async Task DoRestoreAsync(GarnetClient client)
{
var payload = new byte[]
{
Expand All @@ -6431,19 +6434,17 @@ static async Task DoRestoreAsync(GarnetClient client)
0xDB, 0x82, 0x3C, 0x30, 0x38, 0x78, 0x5A, 0x99 // Crc64
};

try
{
string val = await client.ExecuteForStringResultAsync("$7\r\nRESTORE\r\n"u8.ToArray(),
["foo"u8.ToArray(), "0"u8.ToArray(), payload]);
ClassicAssert.AreEqual("OK", val);
}
catch (Exception e)
{
if (e.Message != "ERR Key already exists")
{
throw;
}
}
count++;

var val = await client.ExecuteForStringResultAsync(
"$7\r\nRESTORE\r\n"u8.ToArray(),
[
Encoding.UTF8.GetBytes($"foo-{count}"),
"0"u8.ToArray(),
payload
]);

ClassicAssert.AreEqual("OK", val);
}
}

Expand Down

0 comments on commit eed596f

Please sign in to comment.