Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
hamdaankhalidmsft committed Sep 25, 2024
1 parent 957c131 commit d564238
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 0 deletions.
56 changes: 56 additions & 0 deletions libs/server/Resp/RespCommandsInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1888,6 +1888,20 @@
],
"SubCommands": null
},
{
"Command": "GETIFNOTMATCH",
"Name": "GETIFNOTMATCH",
"IsInternal": false,
"Arity": 2,
"Flags": "NONE",
"FirstKey": 1,
"LastKey": 1,
"Step": 1,
"AclCategories": "Fast, String, Read",
"Tips": null,
"KeySpecifications": null,
"SubCommands": null
},
{
"Command": "GETRANGE",
"Name": "GETRANGE",
Expand Down Expand Up @@ -1917,6 +1931,20 @@
],
"SubCommands": null
},
{
"Command": "GETWITHETAG",
"Name": "GETWITHETAG",
"IsInternal": false,
"Arity": 1,
"Flags": "NONE",
"FirstKey": 1,
"LastKey": 1,
"Step": 1,
"AclCategories": "Fast, String, Read",
"Tips": null,
"KeySpecifications": null,
"SubCommands": null
},
{
"Command": "HDEL",
"Name": "HDEL",
Expand Down Expand Up @@ -4023,6 +4051,20 @@
],
"SubCommands": null
},
{
"Command": "SETIFMATCH",
"Name": "SETIFMATCH",
"IsInternal": false,
"Arity": 3,
"Flags": "NONE",
"FirstKey": 1,
"LastKey": 1,
"Step": 1,
"AclCategories": "Fast, String, Write",
"Tips": null,
"KeySpecifications": null,
"SubCommands": null
},
{
"Command": "SETRANGE",
"Name": "SETRANGE",
Expand Down Expand Up @@ -4052,6 +4094,20 @@
],
"SubCommands": null
},
{
"Command": "SETWITHETAG",
"Name": "SETWITHETAG",
"IsInternal": false,
"Arity": 2,
"Flags": "NONE",
"FirstKey": 1,
"LastKey": 1,
"Step": 1,
"AclCategories": "Fast, String, Write",
"Tips": null,
"KeySpecifications": null,
"SubCommands": null
},
{
"Command": "SINTER",
"Name": "SINTER",
Expand Down
4 changes: 4 additions & 0 deletions playground/CommandInfoUpdater/SupportedCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ public class SupportedCommand
new("GET", RespCommand.GET),
new("GETBIT", RespCommand.GETBIT),
new("GETDEL", RespCommand.GETDEL),
new("GETIFNOTMATCH", RespCommand.GETIFNOTMATCH),
new("GETRANGE", RespCommand.GETRANGE),
new("GETWITHETAG", RespCommand.GETWITHETAG),
new("HDEL", RespCommand.HDEL),
new("HELLO", RespCommand.HELLO),
new("HEXISTS", RespCommand.HEXISTS),
Expand Down Expand Up @@ -211,7 +213,9 @@ public class SupportedCommand
new("SET", RespCommand.SET),
new("SETBIT", RespCommand.SETBIT),
new("SETEX", RespCommand.SETEX),
new("SETIFMATCH", RespCommand.SETIFMATCH),
new("SETRANGE", RespCommand.SETRANGE),
new("SETWITHETAG", RespCommand.SETWITHETAG),
new("SISMEMBER", RespCommand.SISMEMBER),
new("SLAVEOF", RespCommand.SECONDARYOF),
new("SMEMBERS", RespCommand.SMEMBERS),
Expand Down
60 changes: 60 additions & 0 deletions test/Garnet.test/Resp/ACL/RespCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4554,6 +4554,66 @@ static async Task DoSetKeepTtlXxAsync(GarnetClient client)
}
}

[Test]
public async Task SetWithEtagACLsAsync()
{
await CheckCommandsAsync(
"SETWITHETAG",
[DoSetWithEtagAsync]
);

static async Task DoSetWithEtagAsync(GarnetClient client)
{
long val = await client.ExecuteForLongResultAsync("SETWITHETAG", ["foo", "bar"]);
ClassicAssert.AreEqual(0, val);
}
}

[Test]
public async Task SetIfMatchACLsAsync()
{
await CheckCommandsAsync(
"SETIFMATCH",
[DoSetIfMatchAsync]
);

static async Task DoSetIfMatchAsync(GarnetClient client)
{
var res = await client.ExecuteForStringResultAsync("SETIFMATCH", ["foo", "rizz", "0"]);
ClassicAssert.IsNull(res);
}
}

[Test]
public async Task GetIfNotMatchACLsAsync()
{
await CheckCommandsAsync(
"GETIFNOTMATCH",
[DoGetIfNotMatchAsync]
);

static async Task DoGetIfNotMatchAsync(GarnetClient client)
{
var res = await client.ExecuteForStringResultAsync("GETIFNOTMATCH", ["foo", "0"]);
ClassicAssert.IsNull(res);
}
}

[Test]
public async Task GetWithEtagACLsAsync()
{
await CheckCommandsAsync(
"GETWITHETAG",
[DoGetWithEtagAsync]
);

static async Task DoGetWithEtagAsync(GarnetClient client)
{
var res = await client.ExecuteForStringResultAsync("GETWITHETAG", ["foo"]);
ClassicAssert.IsNull(res);
}
}

[Test]
public async Task SetBitACLsAsync()
{
Expand Down

0 comments on commit d564238

Please sign in to comment.