From 1ad26e431ab2d4def464e33536c46575f09ae3fb Mon Sep 17 00:00:00 2001 From: adi_holden Date: Mon, 30 Dec 2024 16:04:43 +0200 Subject: [PATCH] fix json debug populate Signed-off-by: adi_holden --- src/server/debugcmd.cc | 5 +++-- tests/dragonfly/memory_test.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server/debugcmd.cc b/src/server/debugcmd.cc index 13bbbd9bbf07..9b23f4f1e307 100644 --- a/src/server/debugcmd.cc +++ b/src/server/debugcmd.cc @@ -124,12 +124,13 @@ tuple> GeneratePopulateCommand( args.push_back(GenerateValue(val_size, random_value, gen)); } } else if (type == "JSON") { - cid = registry.Find("JSON.SET"); + cid = registry.Find("JSON.MERGE"); args.push_back("$"); string json = "{"; for (size_t i = 0; i < elements; ++i) { - absl::StrAppend(&json, "\"", i, "\":\"", GenerateValue(val_size, random_value, gen), "\","); + absl::StrAppend(&json, "\"", GenerateValue(val_size / 2, random_value, gen), "\":\"", + GenerateValue(val_size / 2, random_value, gen), "\","); } json[json.size() - 1] = '}'; // Replace last ',' with '}' args.push_back(json); diff --git a/tests/dragonfly/memory_test.py b/tests/dragonfly/memory_test.py index 292275a2002c..12e65078ed3a 100644 --- a/tests/dragonfly/memory_test.py +++ b/tests/dragonfly/memory_test.py @@ -69,6 +69,7 @@ async def check_memory(): await client.execute_command("DFLY", "LOAD", f"{dbfilename}-summary.dfs") await check_memory() + await client.execute_command("FLUSHALL") @pytest.mark.asyncio