Package org.elasticsearch.action.support
Class CancellableActionTestPlugin
java.lang.Object
org.elasticsearch.plugins.Plugin
org.elasticsearch.action.support.CancellableActionTestPlugin
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ActionPlugin
Utility plugin that captures the invocation of an action on a node after the task has been registered with the
TaskManager
,
cancels it (e.g. by closing the connection used for the original REST request), verifies that the corresponding task is cancelled, then
lets the action execution proceed in order to verify that it fails with a TaskCancelledException
. This allows to verify a few key
aspects of the cancellability of tasks:
- The task that the request creates is cancellable.
- The REST handler propagates cancellation to the task it starts.
- The action implementation checks for cancellation at least once.
ActionFilter
it blocks and cancels the action before it even starts executing on the
local node, so it does not verify that the cancellation is processed promptly at all stages of the execution of the action, nor that
cancellations are propagated correctly to subsidiary actions.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.elasticsearch.plugins.Plugin
Plugin.PluginServices
Nested classes/interfaces inherited from interface org.elasticsearch.plugins.ActionPlugin
ActionPlugin.ActionHandler<Request extends ActionRequest,
Response extends ActionResponse> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncapturingActionOnNode
(String actionName, String nodeName) Returns aCancellableActionTestPlugin.CapturingAction
, typically for use in a try-with-resources block, which can be used to capture and cancel exactly one invocation of the specified action on the specified node.Methods inherited from class org.elasticsearch.plugins.Plugin
additionalSettings, close, createComponents, getAdditionalIndexSettingProviders, getBootstrapChecks, getCustomMetadataUpgraders, getExecutorBuilders, getIndexTemplateMetadataUpgrader, getNamedWriteables, getNamedXContent, getSettings, getSettingsFilter, onIndexModule
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.plugins.ActionPlugin
getActions, getMappedActionFilters, getRestHandlers, getRestHeaders, getTaskHeaders, indicesAliasesRequestValidators, mappingRequestValidators
-
Constructor Details
-
CancellableActionTestPlugin
public CancellableActionTestPlugin()
-
-
Method Details
-
capturingActionOnNode
public static CancellableActionTestPlugin.CapturingAction capturingActionOnNode(String actionName, String nodeName) Returns aCancellableActionTestPlugin.CapturingAction
, typically for use in a try-with-resources block, which can be used to capture and cancel exactly one invocation of the specified action on the specified node. -
getActionFilters
- Specified by:
getActionFilters
in interfaceActionPlugin
-