Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(fakeredis): Enable JSON tests in the Fakeredis tests #3773

Conversation

BagritsevichStepan
Copy link
Contributor

@BagritsevichStepan BagritsevichStepan commented Sep 23, 2024

fixes #3671

  1. Fix the issue with the JSON.ARRINDEX command. It should return error for the empty result in the legacy mode
  2. Temporary disable filter expression tests in the test_json_arr_commands.py::test_arrindex
  3. Enable json fakeredis tests

@BagritsevichStepan BagritsevichStepan force-pushed the json/enable_json_fakeredis_tests branch from 927b591 to 184f3ce Compare September 23, 2024 16:08
@BagritsevichStepan BagritsevichStepan self-assigned this Sep 23, 2024
@romange
Copy link
Collaborator

romange commented Sep 23, 2024

Can you please add a unit test for Fix the issue with the JSON.ARRINDEX command. It should return error for the empty result in the legacy mode ?

@romange
Copy link
Collaborator

romange commented Sep 23, 2024

Good work!

@BagritsevichStepan BagritsevichStepan force-pushed the json/enable_json_fakeredis_tests branch from 6991832 to 8a7d31c Compare September 24, 2024 07:20
@BagritsevichStepan BagritsevichStepan requested review from romange and removed request for romange September 25, 2024 08:32
@BagritsevichStepan
Copy link
Contributor Author

Due to the fact that for jsonpathv2=true and jsonpathv2=false we get different error messages, I'm just checking in the test that we get an error.

The problem is mentioned in the #3777 issue. When it will be fixed, we will be able to check the error message in the tests.

}
}

std::optional<JsonPathType> path_type;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that all this values has const default values
kDefaultOnEmpty
and kDefaultJsonPathType
so why do we need to use std::optional?

std::optional<JsonPathType> path_type = std::nullopt;
SavingOrder saving_order{SavingOrder::kSaveLast};
OnEmpty on_empty{OnEmpty::kSendWrongType};
void InitializeEmptyOptions(JsonPathType default_path_type, OnEmpty default_on_empty) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this confusing
calling this function will initialize the values if they are not already initialized?
So do we have flows when we call this function twice with different values and only the first call should set the values?

Signed-off-by: Stsiapan Bahrytsevich <[email protected]>
Signed-off-by: Stsiapan Bahrytsevich <[email protected]>
Signed-off-by: Stsiapan Bahrytsevich <[email protected]>
@BagritsevichStepan BagritsevichStepan force-pushed the json/enable_json_fakeredis_tests branch from 8a7d31c to ea6a3db Compare October 17, 2024 13:10
@BagritsevichStepan BagritsevichStepan merged commit ea9dc9c into dragonflydb:main Oct 23, 2024
9 checks passed
@BagritsevichStepan BagritsevichStepan deleted the json/enable_json_fakeredis_tests branch October 23, 2024 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON bugs in the Fakeredis tests
3 participants