Commit graph

44 commits

Author SHA1 Message Date
David Turner
7ddcfeb638
Fix KibanaThreadPoolIT (#120097)
This test will fail to see the rejection if the GET retries on a
different shard copy, so with this commit we make sure there are no
spare shard copies on which to retry.

Closes #113939
2025-01-15 02:07:58 +11:00
Rene Groeschke
ba61f8c7f7
Update Gradle wrapper to 8.12 (#118683)
This updates the gradle wrapper to 8.12

We addressed deprecation warnings due to the update that includes:

- Fix change in TestOutputEvent api
- Fix deprecation in groovy syntax
- Use latest ospackage plugin containing our fix
- Remove project usages at execution time
- Fix deprecated project references in repository-old-versions
2024-12-30 15:34:24 +01:00
Ryan Ernst
160faa2dfc
Re-enable threadpool blocking in Kibana system index test (#112569)
KibanaThreadPoolIT checks the Kibana system user can write (using the
system read/write threadpools) even when the normal read/write
threadpools are blocked. This commit re-enables a key part of the test
which was disabled.

closes #107625
2024-10-24 09:29:34 -07:00
Tim Brooks
6759ae2e89
Introduce watermarks for indexing pressure backoff (#113912)
Currently we have a relatively basic decider about when to throttling
indexing. This commit adds two levels of watermarks with configurable
bulk size deciders. Additionally, adds additional settings to control
primary, coordinating, and replica rejection limits.
2024-10-02 10:06:33 -06:00
David Turner
baef1386da
Dispatch TransportSingleShardAction response handling (#113630)
We shouldn't be handling these responses on the transport worker.

Closes #110408
2024-10-02 19:44:11 +10:00
Mark Vieira
a59c182f9f
Add AGPLv3 as a supported license 2024-09-13 15:29:46 -07:00
Przemyslaw Gomulka
ddf0029d4b
Enable KibanaThreadPool test and remove search request (#109877)
as per https://github.com/elastic/elasticsearch/issues/107625 the search request
can be force put onto a full queue of blocked threadpool.
this is most likely due to https://github.com/elastic/elasticsearch/issues/97916

this commit reenabled the test, but remove the problematic serach request
2024-06-24 11:28:13 +02:00
Przemyslaw Gomulka
1c63eea9f8
Mute KibanaThreadPoolIT#testBlockedThreadPoolsRejectUserRequests (#108728)
muting as the test is stalling for 20min

#107625
2024-05-16 17:41:34 +02:00
Przemyslaw Gomulka
7f1976dd2e
Trace logging for ESThreadPoolExecutor#remove (#108688)
this is just to find out if we ever remove the tasks from the
threadPoolExecutor in order to make the Kibana(System) ThreadPool tests
reliable
2024-05-15 13:17:00 -04:00
Przemyslaw Gomulka
9ac86fa5bf
Extra debugging for KibanaThreadPoolIT test (#108668)
The test likely has not filled the queue fully, adding debug info
2024-05-15 13:57:58 +02:00
Przemyslaw Gomulka
4e24cf9514
Refactor KibanaThreadPoolIT/SystemIndexThreadPoolTestCase for resiliency (#108463)
the in SystemIndexThreadPoolTestCase#testUserThreadPoolsAreBlocked sometimes was blocked instead of throwing an expected exception (due to a queue on a threadpool being full).
IT happens that submitting a busyTask does not guarantee that it will be executed immediately by a threadpool. It might be that some other task was executing at the time
This commit refactors the way threadpool is populated and makes sure that before the queue are filled, all the busyTasks are executed on threadpools

based on the test failure -> #107625 thread pool's threads were busy, but I cannot tell if a queue was full before the search request was submitted.
2024-05-14 17:01:11 +02:00
William Brafford
5a2dc6dc00
Fix system index thread pool tests (#107443)
* Allow rejected executions when filling up a thread pool queue
* Move test to integration tests
* Avoid setting maxConcurrentShardRequests to 1
* Test all index descriptors defined in the Kibana plugin
2024-04-16 17:11:45 -04:00
Mark Vieira
c9ab20350d
Remove AwaitsFix 2024-04-02 06:22:54 -07:00
Mark Vieira
f078c30be7
AwaitsFix #106957 2024-04-01 08:17:26 -07:00
William Brafford
de6ece610e
Check that operations on the Kibana system index use system index thread pools (#106915)
* Add test to verify Kibana's access to system thread pools
* Block all relevant threads on any number of nodes
* Fill threadpool queues before testing requests that should be blocked
2024-03-31 20:57:25 -04:00
Albert Zaharovits
d6df838307
Refactor REST tests to the new internal cluster rule orchestration (#100399)
This PR is migrating some of the ITs that use either the
`elasticsearch.legacy-java-rest-test` or the
`elasticsearch.legacy-yaml-rest-test` gradle test plugins to the new 
`elasticsearch.internal-java-rest-test` and
`elasticsearch.internal-yaml-rest-test` equivalents. This is the list of
the affected ITs:  * SamlAuthenticationIT  * OperatorPrivilegesIT  *
ProfileIT  * SetSecurityUserProcessorWithWithSecurityDisabledIT  *
AsyncSearchSecurityIT  * SecurityRealmSmokeTestCase  *
KibanaSystemIndexIT  * KerberosAuthenticationIT  * ReindexWithSecurityIT
and ReindexWithSecurityClientYamlTestSuiteIT  *
ReloadSecureSettingsWithPasswordProtectedKeystoreRestIT  * PermissionsIT
from slm:qa:with-security  * Permissions IT from
runtime-fields:with-security  * Permissions IT from ilm:qa:with-securiy 
* GraphWithSecurityIT and GraphWithSecurityInsufficientRoleIT

Related: ES-6751
2023-10-17 07:42:43 -04:00
Aleh Zasypkin
77f3924baa
Revert "Kibana system index does not allow user templates to affect it (#98696)" (#98888)
* Revert "Kibana system index does not allow user templates to affect it (#98696)"

This reverts commit 22393215e7.

* Update docs/changelog/98888.yaml
2023-08-25 19:36:19 +02:00
Rudolf Meijering
22393215e7
Kibana system index does not allow user templates to affect it (#98696)
* Kibana system index does not allow user templates to affect it

* Spotless and compilation fix

---------

Co-authored-by: Athena Brown <athena.brown@elastic.co>
2023-08-23 12:07:00 +02:00
Artem Prigoda
2bc7398754
Use Strings.format instead of String.format(Locale.ROOT, ...) in tests (#92106)
Use local-independent `Strings.format` method instead of `String.format(Locale.ROOT, ...)`. 
Inline `ESTestCase.forbidden` calls with `Strings.format` for the consistency sake.
Add `Strings.format` alias in `common.Strings`
2023-01-03 19:28:27 +01:00
Mark Vieira
c2eda511de
Add JUnit rule based integration test cluster orchestration framework (#92379)
This commit adds a new test framework for configuring and orchestrating
test clusters for both Java and YAML REST testing. This will eventually
replace the existing "test-clusters" Gradle plugin and the build-time
cluster orchestration.
2022-12-21 15:33:46 -08:00
Rene Groeschke
43a0377735
Update forbiddenapis to 3.4 (#90624)
Fix breaking changes to source validation after change in default jdk rule set
2022-10-06 16:52:06 +02:00
Nikola Grcevski
0ddb590842
Prevent migration of system indices that match templates (#87933) 2022-06-23 10:59:12 -04:00
Chris Hegarty
e590c41be5
Modularize the kibana, mapper-extras, parent-join, and systemd, components (#87794) 2022-06-17 14:12:27 +01:00
Ievgen Degtiarenko
01c5bc04e8
replace .collect(toUnmodifiableList()) with .toList() (#84760)
Replace collect with a simipler toList call that also creates immutable
collection.
2022-03-10 10:27:46 +01:00
Ryan Ernst
8e8e53af86
Remove dependency on reindex (#84647)
The kibana module only defines a system index, it has no need to include
the reindex module.
2022-03-03 18:38:41 -08:00
Artem Prigoda
763d6d510f
Use Java 15 text blocks for JSON and multiline strings (#80751)
The ES code base is quite JSON heavy. It uses a lot of multi-line JSON requests in tests which need to be escaped and concatenated which in turn makes them hard to read. Let's try to leverage Java 15 text blocks for representing them.
2021-12-15 18:01:28 +01:00
William Brafford
a0fda84da5
All system indices are hidden indices (#79512)
System indices should be hidden from users. Since they are already restricted
indices, a users that can't view restricted indices already can't see or access
them, but they should also be hidden for superusers or users that are otherwise
granted advanced privileges.

To the greatest degree possible, we apply hidden settings in the transport
layer, so that the system can create an index or alias that is set to visible,
for example, when operating in a mixed cluster mode. However, in the case of
aliases created by templates, we hide the alias in the service layer.

This change has broken a number of tests that were relaying unnecessarily on
wildcard searches. In general, the fix for these issues was to apply
expand_wildcards=open,hidden to the request.

* Force system indices to be hidden in IndexMetadata
* Hide system data streams
* Update feature migration tests
* ML datafeed config defaults to searching hidden indices
* Prevent unmanaged system indices from becoming visible
* Change validation in TransportUpdateSettingsAction
* Validate index creation settings in transport action
* Make sure system data stream backing indices are hidden
* Make sure transport request adds hidden index setting if missing
* Validate and set default for autocreated system indices
* Add some code to hide system aliases
* Hide system aliases in create index service
* Hide system aliases when adding them via alias endpoints
* Check system indices when simulating and validating templates
* Add known issue for reenabling tests

* Update docs/changelog/79512.yaml
2021-12-06 14:52:33 -05:00
Chris Hegarty
20c9f756d2
Fix split package org.elasticsearch.common.xcontent (#78831)
Fix the split package org.elasticsearch.common.xcontent, between server and the x-content lib. Move the x-content lib exported package from org.elasticsearch.common.xcontent to org.elasticsearch.xcontent ( following the naming convention of similar libraries ). Removing split packages is a prerequisite to modularization.
2021-10-08 17:14:26 +01:00
Gordon Brown
329d5969ef
Require System Index Descriptors to allow a specific suffix (#78355)
Previously, the leading `.` at the start of system and associated index
descriptor patterns was not properly replaced before being compiled as a
regular expression, leading to any single-character prefix matching.

This commit fixes the issue and adds tests to catch it.
2021-09-30 15:36:13 -06:00
Rene Groeschke
6ef13abe81
Do not create unused testCluster (#77581)
* Do not create unused testCluster

This avoids creating test clusters that are not required during the build.
We use lazy configuration here on testClusters and only instantiate them as theyre

* Do not fail on run task (debug)

* Create more test cluster lazy

* Make more test cluster lazy

* Avoid creating unused testcluster

* Fix PluginBuildPlugin

* Fix disabling geo db download

* Fix cluster setup in repository-multi-version

* Polishing

* Fix issue with irretic groovy ogic

* Fix bwc tests

* Fix more bwcTests

* Fix more bwc tests

* Fix more bwc tests

* Fix more bwc tests

* Fix typo

* Minor polishing

* Fix rolling upgrade tests

* Fix cluster config in sql qa mixedcluster project

* Fix more bwc tests

* Clean up before review

* Document test cluster usage

* Api polising after Review

provide useCluster(Provider) method to TestClusterAware

Ideally we take this a step further and realize those test clusters only on use.
But out of scope of this PR.

* Allow gradle provider as value for nonSystemProperties

* Some simplification on test configuration

* Fix typo in rest test config

* Fix more typos

* Fix another typo

* Fix more typos
2021-09-23 03:45:59 -04:00
Mark Vieira
2393eaf6df
Introduce external build-tools JavaRestTestPlugin (#77603)
* Add external build tools JavaRestTestPlugin

* Fix integration test

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-09-13 14:10:22 -04:00
Rory Hunter
a5d2251064
Order imports when reformatting (#74059)
Change the formatter config to sort / order imports, and reformat the
codebase. We already had a config file for Eclipse users, so Spotless now
uses that.

The "Eclipse Code Formatter" plugin ought to be able to use this file as
well for import ordering, but in my experiments the results were poor.
Instead, use IntelliJ's `.editorconfig` support to configure import
ordering.

I've also added a config file for the formatter plugin.

Other changes:
   * I've quietly enabled the `toggleOnOff` option for Spotless. It was
     already possible to disable formatting for sections using the markers
     for docs snippets, so enabling this option just accepts this reality
     and makes it possible via `formatter:off` and `formatter:on` without
     the restrictions around line length. It should still only be used as
     a very last resort and with good reason.
   * I've removed mention of the `paddedCell` option from the contributing
     guide, since I haven't had to use that option for a very long time. I
     moved the docs to the spotless config.
2021-06-16 09:22:22 +01:00
Jay Modi
1487a5a991
Introduce system index types including external (#68919)
This commit introduces system index types that will be used to
differentiate behavior. Previously system indices were all treated the
same regardless of whether they belonged to Elasticsearch, a stack
component, or one of our solutions. Upon further discussion and
analysis this decision was not in the best interest of the various
teams and instead a new type of system index was needed. These system
indices will be referred to as external system indices. Within external
system indices, an option exists for these indices to be managed by
Elasticsearch or to be managed by the external product.

In order to represent this within Elasticsearch, each system index will
have a type and this type will be used to control behavior.

Closes #67383
2021-03-01 10:38:53 -07:00
Gordon Brown
3f6472de74
Introduce "Feature States" for managing snapshots of system indices (#63513)
This PR expands the meaning of `include_global_state` for snapshots to include system indices. If `include_global_state` is `true` on creation, system indices will be included in the snapshot regardless of the contents of the `indices` field. If `include_global_state` is `true` on restoration, system indices will be restored (if included in the snapshot), regardless of the contents of the `indices` field. Index renaming is not applied to system indices, as system indices rely on their names matching certain patterns. If restored system indices are already present, they are automatically deleted prior to restoration from the snapshot to avoid conflicts.

This behavior can be overridden to an extent by including a new field in the snapshot creation or restoration call, `feature_states`, which contains an array of strings indicating the "feature" for which system indices should be snapshotted or restored. For example, this call will only restore the `watcher` and `security` system indices (in addition to `index_1`):

```
POST /_snapshot/my_repository/snapshot_2/_restore
{
  "indices": "index_1",
  "include_global_state": true,
  "feature_states": ["watcher", "security"]
}
```

If `feature_states` is present, the system indices associated with those features will be snapshotted or restored regardless of the value of `include_global_state`. All system indices can be omitted by providing a special value of `none` (`"feature_states": ["none"]`), or included by omitting the field or explicitly providing an empty array (`"feature_states": []`), similar to the `indices` field.

The list of currently available features can be retrieved via a new "Get Snapshottable Features" API:
```
GET /_snapshottable_features
```

which returns a response of the form:
```
{
    "features": [
        {
            "name": "tasks",
            "description": "Manages task results"
        },
        {
            "name": "kibana",
            "description": "Manages Kibana configuration and reports"
        }
    ]
}
```

Features currently map one-to-one with `SystemIndexPlugin`s, but this should be considered an implementation detail. The Get Snapshottable Features API and snapshot creation rely upon all relevant plugins being installed on the master node.

Further, the list of feature states included in a given snapshot is exposed by the Get Snapshot API, which now includes a new field, `feature_states`, which contains a list of the feature states and their associated system indices which are included in the snapshot. All system indices in feature states are also included in the `indices` array for backwards compatibility, although explicitly requesting system indices included in a feature state is deprecated. For example, an excerpt from the Get Snapshot API showing `feature_states`:
```
"feature_states": [
    {
        "feature_name": "tasks",
        "indices": [
            ".tasks"
        ]
    }
],
"indices": [
    ".tasks",
    "test1",
    "test2"
]
```

Co-authored-by: William Brafford <william.brafford@elastic.co>
2021-02-11 11:55:14 -07:00
Mark Vieira
a92a647b9f Update sources with new SSPL+Elastic-2.0 license headers
As per the new licensing change for Elasticsearch and Kibana this commit
moves existing Apache 2.0 licensed source code to the new dual license
SSPL+Elastic license 2.0. In addition, existing x-pack code now uses
the new version 2.0 of the Elastic license. Full changes include:

 - Updating LICENSE and NOTICE files throughout the code base, as well
   as those packaged in our published artifacts
 - Update IDE integration to now use the new license header on newly
   created source files
 - Remove references to the "OSS" distribution from our documentation
 - Update build time verification checks to no longer allow Apache 2.0
   license header in Elasticsearch source code
 - Replace all existing Apache 2.0 license headers for non-xpack code
   with updated header (vendored code with Apache 2.0 headers obviously
   remains the same).
 - Replace all Elastic license 1.0 headers with new 2.0 header in xpack.
2021-02-02 16:10:53 -08:00
Jay Modi
f47fedd2a8
Correct system index names in Kibana module (#63950)
This commit updates the list of system index names to be complete and
correct for Kibana and APM. The pattern `.kibana*` is too inclusive for
system indices and actually includes the
`.kibana-event-log-${version}-${int}` pattern for the Kibana event log,
which should only be hidden and not a system index. Additionally, the
`.apm-custom-link` index was not included in the list of system
indices. Finally, the reporting pattern has been updated to match that
of the permissions given to the kibana_system role.
2020-10-21 08:58:24 -06:00
William Brafford
7f2930e67a
Add APM configuration index to Kibana system indices (#63756)
* Add APM index to Kibana system indices, making it 
accessible through the _kibana endpoint and giving it the
same access privileges as the other Kibana system indices.
* Parameterize kibana system index tests by index name
2020-10-19 17:18:15 -04:00
Gordon Brown
91f4b58bf7
Deprecate REST access to System Indices (#60945)
This PR adds deprecation warnings when accessing System Indices via the REST layer. At this time, these warnings are only enabled for Snapshot builds by default, to allow projects external to Elasticsearch additional time to adjust their access patterns.

Deprecation warnings will be triggered by all REST requests which access registered System Indices, except for purpose-specific APIs which access System Indices as an implementation detail a few specific APIs which will continue to allow access to system indices by default:

- `GET _cluster/health`
- `GET {index}/_recovery`
- `GET _cluster/allocation/explain`
- `GET _cluster/state`
- `POST _cluster/reroute`
- `GET {index}/_stats`
- `GET {index}/_segments`
- `GET {index}/_shard_stores`
- `GET _cat/[indices,aliases,health,recovery,shards,segments]`

Deprecation warnings for accessing system indices take the form:
```
this request accesses system indices: [.some_system_index], but in a future major version, direct access to system indices will be prevented by default
```
2020-10-06 11:13:48 -06:00
Ryan Ernst
ccb3e2228b
Simplify adding plugins and modules to testclusters (#61886)
There are currently half a dozen ways to add plugins and modules for
test clusters to use. All of them require the calling project to peek
into the plugin or module they want to use to grab its bundlePlugin
task, and then both depend on that task, as well as extract the archive
path the task will produce. This creates cross project dependencies that
are difficult to detect, and if the dependent plugin/module has not yet
been configured, the build will fail because the task does not yet
exist.

This commit makes the plugin and module methods for testclusters
symmetetric, and simply adding a file provider directly, or a project
path that will produce the plugin/module zip. Internally this new
variant uses normal configuration/dependencies across projects to get
the zip artifact. It also has the added benefit of no longer needing the
caller to add to the test task a dependsOn for bundlePlugin task.
2020-09-03 19:26:44 -07:00
Jake Landis
7dd57c9415
Introduce javaRestTest source set/task and convert modules (#59939)
Introduce a javaRestTest source set and task to compliment the yamlRestTest.
javaRestTest differs such that the code is sourced from Java and may have
different dependencies and setup requirements for the test clusters. This also
allows the tests to run in parallel in different cluster instances to prevent any
cross test contamination between the two types of tests.

Included in this PR is all :modules no longer use the integTest task. The tests
are now driven by test, yamlRestTest, javaRestTest, and internalClusterTest.
Since only :modules (and :rest-api-spec) have been converted to yamlRestTest
we can now disable the integTest task if either yamlRestTest or javaRestTest have
been applied. Once all projects are converted, we can delete the integTest task.

related: #56841
related: #59444
2020-07-21 17:17:17 -05:00
Rene Groeschke
9526c7a4b3
Replace compile configuration usage with api (#58451)
- Use java-library instead of plugin to allow api configuration usage
- Remove explicit references to runtime configurations in dependency declarations
- Make test runtime classpath input for testing convention
  - required as java library will by default not have build jar file
  - jar file is now explicit input of the task and gradle will ensure its properly build
2020-06-30 09:37:09 +02:00
Jay Modi
57bd6d2c4a
Reintroduce system index APIs for Kibana (#54858)
This change reintroduces the system index APIs for Kibana without the
changes made for marking what system indices could be accessed using
these APIs. In essence, this is a partial revert of #53912. The changes
for marking what system indices should be allowed access will be
handled in a separate change.

The APIs introduced here are wrapped versions of the existing REST
endpoints. A new setting is also introduced since the Kibana system
indices' names are allowed to be changed by a user in case multiple
instances of Kibana use the same instance of Elasticsearch.

Relates #52385
2020-04-07 22:37:58 -06:00
Ryan Ernst
8264bdd36a
Revert "Introduce system index APIs for Kibana (#52385)" (#53912)
This reverts commit 4c0e8f12cb.

It should be re-added once #53909 is addressed.
2020-03-23 09:11:16 -07:00
Jay Modi
4c0e8f12cb
Introduce system index APIs for Kibana (#52385)
This commit introduces a module for Kibana that exposes REST APIs that
will be used by Kibana for access to its system indices. These APIs are wrapped
versions of the existing REST endpoints. A new setting is also introduced since
the Kibana system indices' names are allowed to be changed by a user in case
multiple instances of Kibana use the same instance of Elasticsearch.

Additionally, the ThreadContext has been extended to indicate that the use of
system indices may be allowed in a request. This will be built upon in the future
for the protection of system indices.
2020-03-02 14:32:41 -07:00