-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Expose master timeout for ILM actions #51130
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b5a80cf
Master timeout in ILM actions
probakowski 9b22911
Tests
probakowski 4823366
Merge remote-tracking branch 'origin/master' into ilm-master-timeout
probakowski f93a909
Additional tests/refactoring
probakowski 7bd6d9a
Spelling fix
probakowski 6b63fcc
Moved setting to LifecycleSettings
probakowski 5540736
Changed evaluateCondition method
probakowski 9d3c67f
Unused imports removed
probakowski 9bcf64b
Compilation fixed
probakowski 264f5a4
Unused imports removed
probakowski 55fbd4c
Test fix
probakowski 090b6b4
Merge branch 'master' into ilm-master-timeout
elasticmachine 7cc4dc5
PR review comments
probakowski e2be196
PR review comments
probakowski 2be4972
Unused imports removed
probakowski 4d16cd6
Merge branch 'master' into ilm-master-timeout
elasticmachine 32d263e
PR review comments
probakowski 393111e
Removed unnecessary changes
probakowski fd0a507
Merge branch 'master' into ilm-master-timeout
probakowski 6fc450f
Setup/teardown renamed
probakowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...ore/src/test/java/org/elasticsearch/xpack/core/ilm/AbstractStepMasterTimeoutTestCase.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.core.ilm; | ||
|
||
import org.elasticsearch.action.support.master.MasterNodeRequest; | ||
import org.elasticsearch.client.AdminClient; | ||
import org.elasticsearch.client.Client; | ||
import org.elasticsearch.client.IndicesAdminClient; | ||
import org.elasticsearch.cluster.ClusterName; | ||
import org.elasticsearch.cluster.ClusterState; | ||
import org.elasticsearch.cluster.metadata.IndexMetaData; | ||
import org.elasticsearch.cluster.metadata.MetaData; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.common.unit.TimeValue; | ||
import org.junit.Before; | ||
import org.mockito.Mockito; | ||
import org.mockito.stubbing.Stubber; | ||
|
||
import static org.elasticsearch.xpack.core.ilm.LifecycleSettings.LIFECYCLE_STEP_MASTER_TIMEOUT; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
public abstract class AbstractStepMasterTimeoutTestCase<T extends AsyncActionStep> extends AbstractStepTestCase<T> { | ||
|
||
protected Client client; | ||
protected AdminClient adminClient; | ||
protected IndicesAdminClient indicesClient; | ||
|
||
@Before | ||
public void setup() { | ||
client = Mockito.mock(Client.class); | ||
probakowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
adminClient = Mockito.mock(AdminClient.class); | ||
Mockito.when(client.admin()).thenReturn(adminClient); | ||
indicesClient = Mockito.mock(IndicesAdminClient.class); | ||
Mockito.when(adminClient.indices()).thenReturn(indicesClient); | ||
} | ||
|
||
public void testMasterTimeout() { | ||
checkMasterTimeout(TimeValue.timeValueSeconds(30), | ||
ClusterState.builder(ClusterName.DEFAULT).metaData(MetaData.builder().build()).build()); | ||
checkMasterTimeout(TimeValue.timeValueSeconds(10), | ||
ClusterState.builder(ClusterName.DEFAULT) | ||
.metaData(MetaData.builder() | ||
.persistentSettings(Settings.builder().put(LIFECYCLE_STEP_MASTER_TIMEOUT, "10s").build()) | ||
.build()) | ||
.build()); | ||
} | ||
|
||
@SuppressWarnings("rawtypes") | ||
private void checkMasterTimeout(TimeValue timeValue, ClusterState currentClusterState) { | ||
IndexMetaData indexMetadata = getIndexMetaData(); | ||
|
||
Stubber checkTimeout = Mockito.doAnswer(invocation -> { | ||
probakowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
for(Object argument: invocation.getArguments()){ | ||
if(argument instanceof MasterNodeRequest) | ||
{ | ||
@SuppressWarnings("rawtypes") MasterNodeRequest<?> request = (MasterNodeRequest) argument; | ||
assertThat(request.masterNodeTimeout(), equalTo(timeValue)); | ||
} | ||
} | ||
return null; | ||
}); | ||
mockRequestCall(checkTimeout); | ||
T step = createRandomInstance(); | ||
step.performAction(indexMetadata, currentClusterState, null, new AsyncActionStep.Listener() { | ||
@Override | ||
public void onResponse(boolean complete) { | ||
|
||
} | ||
|
||
@Override | ||
public void onFailure(Exception e) { | ||
|
||
} | ||
}); | ||
} | ||
|
||
protected abstract IndexMetaData getIndexMetaData(); | ||
|
||
protected abstract void mockRequestCall(Stubber checkTimeout); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.