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

Enable casting config values of most types #343

Merged
merged 5 commits into from
Oct 4, 2024

Conversation

andrew4699
Copy link
Contributor

@andrew4699 andrew4699 commented Oct 3, 2024

Description

Implementations of PolarisConfigurationStore may return strings regardless of the config type. In particular, one place where this happens when specifying a ConfigOverride in a test.

Currently, the interface checks the expected type for booleans and Lists and casts them to the correct config type. Whether this is a pattern we should proliferate or not is up for debate, but this PR simply extends the existing logic to work for other types, and it adds tests to ensure the different castings work. Without this PR, the test fails.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • PolarisConfigurationStoreTest. Without this PR, the test fails.

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

Copy link
Contributor

@eric-maynard eric-maynard left a comment

Choose a reason for hiding this comment

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

LGTM!

/** Unit test for the default behaviors of the PolarisConfigurationStore interface. */
public class PolarisConfigurationStoreTest {
@Test
public void testConfigsCanBeCastedFromString() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add a test for the negative case? e.g. a string is provided for an int

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

Copy link
Contributor

@eric-maynard eric-maynard left a comment

Choose a reason for hiding this comment

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

LGTM, looks good to merge

@eric-maynard eric-maynard merged commit 213fd0d into apache:main Oct 4, 2024
4 checks passed
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.

2 participants