Skip to content

Commit

Permalink
fix json debug populate
Browse files Browse the repository at this point in the history
Signed-off-by: adi_holden <[email protected]>
  • Loading branch information
adiholden committed Dec 30, 2024
1 parent 84398b9 commit 1ad26e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/server/debugcmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,13 @@ tuple<const CommandId*, absl::InlinedVector<string, 5>> 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);
Expand Down
1 change: 1 addition & 0 deletions tests/dragonfly/memory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1ad26e4

Please sign in to comment.