fix(json_family): Fix error in JsonFamilyTest.MGet (#3285)

* fix(json_family): Fix error in JsonFamilyTest.MGet

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor(json_family): address comments

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor(json_family): Change LOG(WARNING) to VLOG(2)

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* fix(json_family): Test case when jsonpathv2 is false

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor(json_family): Update VLOGs level from 2 to 1

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

---------

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>
This commit is contained in:
Stepan Bagritsevich 2024-07-09 16:02:33 +04:00 committed by GitHub
parent 628985bed2
commit e914a5f7cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View File

@ -156,6 +156,7 @@ jobs:
./dragonfly_test
./multi_test --multi_exec_mode=1
./multi_test --multi_exec_mode=3
./json_family_test --jsonpathv2=false
- name: Upload unit logs on failure
if: failure()

View File

@ -1447,10 +1447,16 @@ io::Result<JsonPathV2, string> ParsePathV2(string_view path) {
}
if (absl::GetFlag(FLAGS_jsonpathv2)) {
return json::ParsePath(path);
auto path_result = json::ParsePath(path);
if (!path_result) {
VLOG(1) << "Invalid Json path: " << path << ' ' << path_result.error() << std::endl;
return nonstd::make_unexpected(kSyntaxErr);
}
return path_result;
}
io::Result<JsonExpression> expr_result = ParseJsonPath(path);
if (!expr_result) {
VLOG(1) << "Invalid Json path: " << path << ' ' << expr_result.error() << std::endl;
return nonstd::make_unexpected(kSyntaxErr);
}
return JsonPathV2(std::move(expr_result.value()));

View File

@ -982,7 +982,7 @@ TEST_F(JsonFamilyTest, MGet) {
#ifndef SANITIZERS
resp = Run({"JSON.MGET", "json1", "??INNNNVALID??"});
EXPECT_THAT(resp, ErrArg("Unknown token"));
EXPECT_THAT(resp, ErrArg("ERR syntax error"));
#endif
resp = Run({"JSON.MGET", "json1", "json2", "json3", "$.address.country"});