-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
CORE: Validate list values for settings #71276
Conversation
Settings value could be a list. This should only happen if the underlying setting type is a list setting type. * Validation has been added that * when we get a setting value which is list, setting is also a list setting * when we get a value for a list setting, underlying value is also a list * Closes #33135
Pinging @elastic/es-core-infra (Team:Core/Infra) |
ok to test |
@elasticmachine update branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thanks!
can you add the testcase for happy path and fix the failing test?
You might need to change the exception message and remove the if condition that throws Environment
String rawDataPath = PATH_DATA_SETTING.get(settings);
if (rawDataPath.startsWith("[")) {
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> stringSetting.get(settings)); | ||
assertEquals("Found list type value for setting [foo.bar] but did not expect a list for it.", e.getMessage()); | ||
} | ||
|
||
public void testGetAsArrayFailsOnDuplicates() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we also have a happy path testcase where Setting.listSetting
parses successfully ?
@amitds1997 Are you still interested in getting this PR in? If so can you please address the comments Przemek made above? |
Sorry, I won't be able to get this through. Anyone else can take this up. Thanks! |
Settings value could be a list. This should only
happen if the underlying setting type is a list setting type.
is also a list setting
value is also a list