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

kv-store: support quoted values #28

Merged
merged 2 commits into from
Oct 17, 2023
Merged

Conversation

tormath1
Copy link
Contributor

@tormath1 tormath1 commented Oct 12, 2023

Locally tested with update_engine_client -check_for_update then inspecting the request/response.

Before adding the patch, I added test cases that fails with:

 Expected equality of these values:
  "my alias"
  (*test_map)["ALIAS"]
    Which is: "'my alias'"
i = 0
src/update_engine/simple_key_value_store_unittest.cc:37: Failure
Expected equality of these values:
  "this is a test"
  (*test_map)["TEST"]
    Which is: "\"this is a test\""
i = 0

Flatcar CI here: http://jenkins.infra.kinvolk.io:8080/job/container/job/packages_all_arches/2725/cldsv/

@tormath1 tormath1 self-assigned this Oct 12, 2023
Useful to test when the value contains whitespaces surrounded with
quotes/double-quotes.

Signed-off-by: Mathieu Tortuyaux <[email protected]>
Comment on lines 32 to 33
((val.at(0) == '\"' && val.at(val.length() - 1) == '\"') ||
(val.at(0) == '\'' && val.at(val.length() - 1) == '\''))) {
Copy link
Member

Choose a reason for hiding this comment

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

Try these instead:
val.front()
val.back()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tips! Looks good on the CI.

@tormath1 tormath1 changed the title [wip] kv-store: support quoted values kv-store: support quoted values Oct 12, 2023
In the case of the value contains whitespaces, it has to be surrounded
with quotes (single or double).

We should exclude these characters from the final values.

Signed-off-by: Mathieu Tortuyaux <[email protected]>
@tormath1 tormath1 marked this pull request as ready for review October 12, 2023 16:04
@tormath1 tormath1 requested a review from a team October 12, 2023 16:04
@tormath1 tormath1 merged commit 1130900 into flatcar-master Oct 17, 2023
1 check passed
@tormath1 tormath1 deleted the tormath1/kv-store branch October 17, 2023 08:06
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.

3 participants