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

Test: Allow merging mock secure settings #25387

Merged
merged 3 commits into from
Jun 25, 2017
Merged

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Jun 23, 2017

While real secure settings (ie an ES keystore) cannot be merged
together, mocked secure settings can and need to be sometimes merged.
This commit adds a merge method to allow tests to merge together
multiple instances of secure settings. Also, a bit of unfortunate leniency is added, which makes passing an empty secure settings a no-op (eg when a test has an empty MockSecureSettings). Finally it adds an explicit error message when secure settings are already set on the settings builder.

While real secure settings (ie an ES keystore) cannot be merged
together, mocked secure settings can and need to be sometimes merged.
This commit adds a merge method to allow tests to merge together
multiple instances of secure settings.
@rjernst rjernst added :Core/Infra/Settings Settings infrastructure and APIs >test Issues or PRs that are addressing/adding tests v5.6.0 v6.0.0 labels Jun 23, 2017
Copy link
Contributor

@s1monw s1monw left a comment

Choose a reason for hiding this comment

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

LGTM but I left a question

@@ -718,6 +718,14 @@ public Builder setSecureSettings(SecureSettings secureSettings) {
if (secureSettings.isLoaded() == false) {
throw new IllegalStateException("Secure settings must already be loaded");
}
if (secureSettings.getSettingNames().isEmpty()) {
// TODO: fix this leniency!!!
Copy link
Contributor

Choose a reason for hiding this comment

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

I ran into this a couple of times working on the branch. Can we throw an exception instead?

@rjernst
Copy link
Member Author

rjernst commented Jun 24, 2017

@s1monw I removed the leniency, and instead changed the offending code to only merge non secure settings. Can you take another look?

Copy link
Contributor

@s1monw s1monw left a comment

Choose a reason for hiding this comment

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

LGTM thx for the cleanup

@rjernst rjernst merged commit 1583f81 into elastic:master Jun 25, 2017
@rjernst rjernst deleted the keystore18 branch June 25, 2017 17:19
rjernst added a commit that referenced this pull request Jun 25, 2017
While real secure settings (ie an ES keystore) cannot be merged
together, mocked secure settings can and need to be sometimes merged.
This commit adds a merge method to allow tests to merge together
multiple instances of secure settings.
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Jun 26, 2017
* master:
  Move more token filters to analysis-common module
  Test: Allow merging mock secure settings (elastic#25387)
  Remove remaining `index.mapper.single_type` setting usage from tests (elastic#25388)
  Remove dead logger prefix code
  Tests: Improve stability and logging of TemplateUpgradeServiceIT tests (elastic#25386)
  Remove `index.mapping.single_type=false` from reindex tests (elastic#25365)
  Adapt `SearchIT#testSearchWithParentJoin` to new join field (elastic#25379)
  Added unit test coverage for SignificantTerms (elastic#24904)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Settings Settings infrastructure and APIs >test Issues or PRs that are addressing/adding tests v5.6.0 v6.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants