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

Allow setting numeric config variables in config update endpoint #9548

Merged
merged 2 commits into from Nov 3, 2023

Conversation

whummer
Copy link
Member

@whummer whummer commented Nov 3, 2023

Motivation

One of the Chaos Engineering features we want to enable in the Web app with @webdev51 is setting the KINESIS_ERROR_PROBABILITY/DYNAMODB_ERROR_PROBABILITY config variables, to simulate rate limiting for Kinesis/DynamoDB.

This can be enabled by asking the user to enable ENABLE_CONFIG_UPDATES=1 on LS startup (with the caveats / security implications that come with it, and which we have also documented in our docs), and then using the config update endpoint.

However, currently updating the value to ENABLE_CONFIG_UPDATES=1 is not fully working, as the service providers expect those values to be numeric, whereas the config update listener sets them as string. It seems reasonable to check if config values are numeric, and then convert them to float (the other approach would be to fix the logic in the provider, to be able to handle both float and str values).

Changes

  • add is_number(..) check to config update, to automatically convert numeric strings to numbers

@whummer whummer added the semver: patch Non-breaking changes which can be included in patch releases label Nov 3, 2023
Copy link
Member

@alexrashed alexrashed left a comment

Choose a reason for hiding this comment

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

The change looks good!
I just feel like this could be somewhat of a rabbit hole without a standardized way of handling things (is the config responsible of the parsing or the providers?). However, the config update is a bit brittle, but somewhat safe if we - as the ones who know its limitations - are using it. 😄

Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

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

Could you maybe add a quick test here? tests.integration.test_config_endpoint.test_config_endpoint

I think the change is rather small and innocuous, but it'd be nice to validate the behaviour.

@coveralls
Copy link

coveralls commented Nov 3, 2023

Coverage Status

coverage: 82.532% (-0.009%) from 82.541%
when pulling fdecb8f on config-update-number
into 469febb on master.

Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

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

thanks a lot for adding the test, LGTM! 👍

del config.FOO
config_listener.CONFIG_LISTENERS.remove(custom_listener)
Copy link
Contributor

Choose a reason for hiding this comment

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

good catch!

Copy link

github-actions bot commented Nov 3, 2023

LocalStack Community integration with Pro

       2 files         2 suites   1h 6m 37s ⏱️
2 327 tests 1 750 ✔️ 577 💤 0
2 328 runs  1 750 ✔️ 578 💤 0

Results for commit fdecb8f.

@whummer whummer merged commit a8f46ae into master Nov 3, 2023
27 checks passed
@whummer whummer deleted the config-update-number branch November 3, 2023 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants