@@ -1204,4 +1204,19 @@ func testString(t *testing.T, configs util.KvrocksServerConfigs) {
12041204 require .Equal (t , []redis.LCSMatchedPosition {}, rdb .LCS (ctx , & redis.LCSQuery {Key1 : "virus1" , Key2 : "virus2" , Idx : true }).Val ().Matches )
12051205 require .Equal (t , []redis.LCSMatchedPosition {}, rdb .LCS (ctx , & redis.LCSQuery {Key1 : "virus1" , Key2 : "virus2" , Idx : true , WithMatchLen : true }).Val ().Matches )
12061206 })
1207+
1208+ t .Run ("DelEX IFDEQ and IFDNE reject invalid digest length" , func (t * testing.T ) {
1209+ key := "test-string-key-invalid-digest"
1210+ value := "Hello world"
1211+
1212+ require .NoError (t , rdb .Del (ctx , key ).Err ())
1213+ require .NoError (t , rdb .Set (ctx , key , value , 0 ).Err ())
1214+ require .ErrorContains (t , rdb .Do (ctx , "DelEX" , key , "ifdeq" , "123456789012345" ).Err (),
1215+ "exactly 16 hexadecimal characters" )
1216+ require .Equal (t , value , rdb .Get (ctx , key ).Val ())
1217+
1218+ require .ErrorContains (t , rdb .Do (ctx , "DelEX" , key , "ifdne" , "123456789012345" ).Err (),
1219+ "exactly 16 hexadecimal characters" )
1220+ require .Equal (t , value , rdb .Get (ctx , key ).Val ())
1221+ })
12071222}
0 commit comments