Commit graph

3265 commits

Author SHA1 Message Date
Simon Cooper
91f217c9f0
Backport #107481 to 7.17 (#108003)
Block specific config files from being accessed after startup (#107481)

Some files should never be accessed by ES or plugin code once startup has completed. Use the security manager to block these files from being accessed by anything at all. The current blocked files are elasticsearch.yml, jvm.options, and the jvm.options.d directory.
2024-04-30 15:02:35 +01:00
Moritz Mack
63eeed8374
Fix random timezone id selection to be consistent with DateUtilsTests.testTimezoneIds (#105989) 2024-03-06 07:35:15 +01:00
Rene Groeschke
457296f31f
Fix :plugins:repository-hdfs:forbiddenApisJavaRestTest (#102983) (#105921)
Reworking forbiddenApis check to use gradle worker api exposed a bug in
how we resolve krb5kdc keytab information. This fixes the depenendency to krb5kdc keytab configuration and
its builtBy task.

This also changes the usage of krb5kdc keytab files to be passed directly to task classpath as
they are only required at runtime and directly having them as part of javaRestTestRuntimeOnly would mean precommit
requires krb5kdc compose up which we definitely not want

(cherry picked from commit ab0bb4889a)
2024-03-05 11:16:20 +01:00
Mark Vieira
9923a8719f
Remove BWC testing of snapshot 6.8 versions (#104226) 2024-01-10 14:21:56 -08:00
David Turner
e573c1d385
Fail listener on exception in TcpTransport#openConnection (#101907) (#101955)
Today `TcpTransport#openConnection` may throw exceptions on certain
kinds of failure, but other kinds of failure are passed to the listener.
This is trappy and not all callers handle it correctly. This commit
makes sure that all exceptions are passed to the listener.

Closes #100510
2023-11-09 08:09:11 -05:00
Joe Gallo
2f8fa89fe3
Refactor WriteableIngestDocument (#99324) (#100224) 2023-10-03 15:32:07 -04:00
Rene Groeschke
5afd06ae57
[7.17] Update Gradle Wrapper to 8.2 (#96686) (#97484)
* Update Gradle Wrapper to 8.2 (#96686)

- Convention usage has been deprecated and was fixed in our build files
- Fix test dependencies and deprecation
2023-09-27 08:46:44 +02:00
Albert Zaharovits
0df52c8f67
Netty4 HTTP authn enhancements (#92220) (#96703)
This is a backport of multiple work items related to authentication enhancements for HTTP,
which were originally merged in the 8.8 - 8.9 releases.
Hence, the HTTP (only the netty4-based implementation (default), not the NIO one) authentication
implementation gets a throughput boost (especially for requests failing authn).

Relates to: ES-6188 #92220 #95112
2023-08-23 18:52:38 +03:00
David Turner
fe18a67f02
Make TransportAddVotingConfigExclusionsAction retryable (#98568)
The docs for this API say the following:

> If the API fails, you can safely retry it. Only a successful response
> guarantees that the node has been removed from the voting
> configuration and will not be reinstated.

Unfortunately this isn't true today: if the request adds no exclusions
then we do not wait before responding. This commit makes the API wait
until all exclusions are really applied.

Backport of #98386, plus the test changes from #98146 and #98356.
2023-08-17 04:49:03 -04:00
Nhat Nguyen
9bb69a21ff
Fix delay timeout in MockTransportService (#97336) (#97338)
We can pass an invalid duration to TimeValue, which accepts either -1 or
an non-negative duration.
2023-07-03 17:40:31 -04:00
David Turner
eeedb98c60
Make cluster health API cancellable (#96990)
This API can be quite heavy in large clusters, and might spam the
`MANAGEMENT` threadpool queue with work for clients that have long-since
given up. This commit adds some basic cancellability checks to reduce
the problem.

Backport of #96551 to 7.17
2023-06-22 08:05:03 +01:00
Mark Vieira
68905df689
Add mechanism to initialize YAML tests against a subset of test cases (#95095) (#95097)
This commit adds the ability to initialize YAML rest test suites against
a subset of available test cases. Previously, the only way to do this is
via the `tests.rest.suite` system property, but that can only be set at
the test _task_ level. Configuring this at the test _class_ level means
that we can support having multiple test suite classes that execute
subsets of tests within a project. That allows for things like
parallelization, or having different test cluster setups for different
YAML tests within the same project.

For example:

```java
    @ParametersFactory
    public static Iterable<Object[]> parameters() throws Exception {
        return ESClientYamlSuiteTestCase.createParameters(new String[] { "analysis-common", "indices.analyze" });
    }
```

The above example would mean that only tests in the `analysis-common`
and `indices.analyze` directories would be included in this suite.

cc @jdconrad 

Closes #95089
2023-04-06 21:35:25 -04:00
Tanguy Leroux
36a70fecf4
[7.17] Log HTTP response trace when sending is complete (#94472)
HttpTracer logs a message when an HTTP response is sent to a HttpChannel
but that does not mean the response sending process is completed.

This pull request changes the HttpTracer so that the message is now
logged when the sending is complete.

Backport of #94436
2023-03-10 12:34:32 -05:00
Ryan Ernst
8113c92b39
Mute disruption tests for jdk20+ (#94207) (#94254)
In JDK 20 Thread suspend/resume is soft removed (they now throw
UnsupportedOperationException). Many ES disruption tests simulate GC
pauses with suspend/resume. As that strategy will no longer work, this
commit mutes those tests for jdk20+.

relates #94206
closes #93707
2023-03-01 16:14:39 -05:00
Mark Vieira
a79da4fc55
Support providing test cluster keystore settings via lazy evaluation (#93765) (#93766)
This adds a `keystore` method to `LocalSpecBuilder` to provide secure
keystore settings via a `Supplier<String>` to allow for lazy-evaluated
settings, such as a secure setting that resolves to the address of
dependent cluster.
2023-02-14 03:44:03 -05:00
Nikolaj Volgushev
11807679f8
Limit test port range to below the Linux default ephemeral port range (#92666) (#93689)
If we use a port range of up to `36600` this means that we have overlap
with Linux' default ephemeral port range starting at 32768. If we get
unlucky there and all ports in a range that overlaps with the ephemeral
ports we will be unable to bind to any port in a node's range and the
test will fail. If we limit the max private port below the ephemeral
range that won't happen at the cost of a slightly higher chance of
collisions due to worker id wraparound, which given that we're still at
600+ids until wrap-around seems rather unlikely while bind failures
have been observed in the real world.

closes #92477

Co-authored-by: Armin Braun <me@obrown.io>
2023-02-10 11:51:15 +01:00
Mark Vieira
cf10666952
[7.17] Use absolute paths for logs locations in JVM options for test clusters (#93672) (#93675)
* Use absolute paths for logs locations in JVM options for test clusters (#93672)

# Conflicts:
#	test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/LocalClusterFactory.java

* Spotless
2023-02-09 18:57:01 -05:00
Mark Vieira
f647ce3390
Use shorter paths for test cluster working directories to avoid issues on Windows (#93570) (#93609)
# Conflicts:
#	test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/LocalClusterFactory.java
2023-02-08 18:32:38 -05:00
Mark Vieira
cdb0c6b892
Avoid copying test cluster distributions when possible (#93486) (#93601) 2023-02-08 14:29:06 -05:00
Mark Vieira
18a5be3c30
[7.17] Convert full cluster restart tests to new rest testing framework (#93422) (#93432)
* Convert full cluster restart tests to new rest testing framework (#93422)

# Conflicts:
#	qa/full-cluster-restart/build.gradle
#	qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/FullClusterRestartIT.java
#	qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.java
#	qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/QueryBuilderBWCIT.java
#	x-pack/plugin/shutdown/qa/full-cluster-restart/build.gradle
#	x-pack/plugin/shutdown/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java
#	x-pack/qa/full-cluster-restart/build.gradle
#	x-pack/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java
#	x-pack/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/xpack/restart/FullClusterRestartSettingsUpgradeIT.java
#	x-pack/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/xpack/restart/MLModelDeploymentFullClusterRestartIT.java
#	x-pack/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/xpack/restart/MlConfigIndexMappingsFullClusterRestartIT.java
#	x-pack/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/xpack/restart/MlHiddenIndicesFullClusterRestartIT.java
#	x-pack/qa/full-cluster-restart/src/javaRestTest/resources/system_key

* Fixes

* Fix warning failures

* Fix heap dump path

* More fixes

* Fix test cluster security setup on Windows

* Use relative path for script execution

* More, more fixes

* Fix warning error

* More fixes

* Fix security warning
2023-02-02 17:58:30 -05:00
Mark Vieira
bfd8cd84c3
Make --debug-server-jvm work with new test framework (#93355) (#93361) 2023-01-31 10:49:07 -08:00
Mark Vieira
ef48222227
Fix MapperSizeClientYamlTestSuiteIT when FIPS is enabled (#93357) (#93365)
The issue with this test failure is actually that we were silently
failing to install the plugin under test into the cluster. The root
cause here was the FIPS security policy file was not copied into cluster
config directory before we attempting to run the plugin installer. Since
we pass the FIPS JVM arguments to all CLI tools as well this caused
plugin installation to fail. We now ensure that these files are copied
before we attempt to run _any_ ES tools.

Closes https://github.com/elastic/elasticsearch/issues/93303
2023-01-30 19:25:04 -05:00
Mark Vieira
1ef47c0d39
Additional fixes to FIPS testing using junit test clusters (#93248) (#93251) 2023-01-25 18:08:39 -05:00
Mark Vieira
78e5eb3d2f
Ensure initial_master_nodes includes only master-eligible nodes (#93212) (#93217) 2023-01-24 19:47:37 -05:00
Mark Vieira
90eb2db9c3
Convert ServiceAccountIT to new test clusters framework (#92604) (#92887) 2023-01-24 15:55:56 -08:00
Mark Vieira
e9af78c799
Add FIPS support to new junit-rule test clusters framework (#93021) (#93111) 2023-01-24 15:55:20 -08:00
Mark Vieira
b8af0f016b
Used a shared repo path for all nodes of a given cluster (#93006) (#93012)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2023-01-17 18:41:10 -05:00
Mark Vieira
689a2b3baf
[7.17] Convert smoke test multinode (#92774) (#92794)
* Convert smoke test multinode (#92774)

# Conflicts:
#	qa/smoke-test-multinode/build.gradle
#	qa/smoke-test-multinode/src/yamlRestTest/java/org/elasticsearch/smoketest/SmokeTestMultiNodeClientYamlTestSuiteIT.java

* Remove unknown roles from test cluster
2023-01-10 12:46:16 -05:00
Mark Vieira
9e1ec97dcf
[7.17] Migrate core rest tests with security to new testing framework (#92575) (#92686)
* Migrate core rest tests with security to new testing framework (#92575)

# Conflicts:
#	x-pack/qa/core-rest-tests-with-security/build.gradle

* Fixes

* More fixes

* More fixes

* More more fixes
2023-01-04 19:17:57 -05:00
Armin Braun
7221c6a279
[8.6] Simplify and optimize deduplication of RepositoryData for a non-caching repository instance (#91851) (#91866) (#92661)
* Simplify and optimize deduplication of RepositoryData for a non-caching repository instance (#91851)

This makes use of the new deduplicator infrastructure to move to more
efficient deduplication mechanics.
The existing solution hardly ever deduplicated because it would only
deduplicate after the repository entered a consistent state. The
adjusted solution is much simpler, in that it simply deduplicates such
that only a single loading of `RepositoryData` will ever happen at a
time, fixing memory issues from massively concurrent loading of the repo
data as described in #89952.

closes #89952

* fix compile
2023-01-04 06:05:46 -05:00
Mark Vieira
0f28d1fcd4
[7.17] Add support for addition configuration files to test clusters framework (#92579) (#92603)
* Add support for addition configuration files to test clusters framework (#92579)

This adds the ability to supply arbitrary files to the config directory
of cluster nodes. Typically, this is used for security use cases, such
as providing for SSL certificates and trust stores.

This commit adds a few other features to enable more testing ues cases
as well, such as the ability to restart a cluster, as well as explicit
ordering of test cases withing a test class. This is needed for test
suites that need to execute some tests, restart the cluster, then
execute more in a particular order.
# Conflicts:
#	test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/LocalClusterHandle.java
#	x-pack/plugin/security/qa/basic-enable-security/build.gradle
#	x-pack/plugin/security/qa/basic-enable-security/src/javaRestTest/java/org/elasticsearch/xpack/security/EnableSecurityOnBasicLicenseIT.java
#	x-pack/qa/multi-node/src/javaRestTest/java/org/elasticsearch/multi_node/GlobalCheckpointSyncActionIT.java

* Fix static initialization of random value

* Remove unused imports

* Spotless
2022-12-29 15:02:07 -05:00
Mark Vieira
223786c051
[7.17] Fixes for module projects in new tests clusters and auto security config (#92533) (#92582)
* Fixes for module projects in new tests clusters and auto security config (#92533)

Fix an issue where the build cannot resolve a module dependency for the
current module project. Also add partial support for security auto-
configuration in test clusters.
# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestBasePlugin.java
#	modules/aggregations/build.gradle
#	modules/aggs-matrix-stats/src/yamlRestTest/java/org/elasticsearch/search/aggregations/matrix/MatrixStatsClientYamlTestSuiteIT.java
#	test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/LocalClusterHandle.java

* Post-merge fixes

* Spotless
2022-12-27 20:57:29 -05:00
Mark Vieira
b5c0d05ee6
Add support for keystore secure settings to test clusters (#92554) (#92557)
Adds support for adding secure settings to node keystore using the new
junit test clusters framework.
2022-12-23 13:24:33 -05:00
Mark Vieira
f1f937a2ce
Convert ccs-common-rest QA project to new test clusters framework (#92516) (#92538) 2022-12-22 22:03:55 -05:00
Mark Vieira
47c6fd34da
[7.17] Add JUnit rule based integration test cluster orchestration framework… (#92517)
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-22 17:48:07 -08:00
Pooya Salehi
cd96706053
[7.17] Wait for task on master in testGetMappingsCancellation (#91709) (#91916) (#91926)
* Wait for task on master in testGetMappingsCancellation (#91709) (#91916)

* replace List.of usage
2022-11-25 04:04:50 -05:00
Francisco Fernández Castaño
807a1564c6
Do not use recovery from snapshots in searchable snapshots (#91759)
This commit disables recovering from snapshots for searchable snapshots
as the snapshot for these type of indices consist in a pointer to the
original snapshot and it produced confusing error messages.

Backport of #86388
2022-11-21 16:03:58 +01:00
Nikola Grcevski
5466943d05
Port 91297 to 7.17 (#91431) 2022-11-08 15:43:22 -05:00
Pooya Salehi
a9b79a7386
Increase assertAllCancellableTasksAreCancelled timeout (#89744) (#89749)
The following two failures happen rarely, but both fail in the same
`assertBusy` block. I don't have a clue why, and couldn't reproduce
them. Considering the amount of checks in that block, maybe a larger
timeout is more suitable. (Also it seems from the test history, it is
not uncommon for those tests to take 2-3s, so every few thousand runs
hitting the 10s timeout seems likely, IMO!)  Relates
https://github.com/elastic/elasticsearch/issues/88884,
https://github.com/elastic/elasticsearch/issues/88201
2022-08-31 20:54:09 +09:30
Rene Groeschke
6002a5e456
Show -Dlicense.key value in test repro info (#66179) (#89404)
- When a -Dlicense.key sys property is passed to the build we want to consider
this in the test reproduction info message
- Absolute Paths tried to be converted to relative paths relative to workspace
root to allow simply copy & paste
- Also fixes a inconsistency for checking license existence in x-pack plugin core build
2022-08-17 17:17:54 +09:30
Tanguy Leroux
17f4e0b141
[7.17] Fix mount snapshot api ignoring unknown request parameter (#89061)
The High Level REST Client provides a MountSnapshotRequest#ignoredIndexSettings(String[]) method to define some index settings to ignore when mounting a snapshot as a searchable snapshot index.

Sadly the client generates a wrong request body field ignored_index_settings instead of ignore_index_settings. This wasn't caught until #75982 was reported because the parser of Mount API request ignores unknown fields in request body.

We fixed the wrong leniency of the request parser on the Elasticsearch side (#88987) starting version 8.5.0, and we decided to continue to ignore the ignored_index_settings generated by the HLRC bug to avoid breaking HLRC client usages.

This change fixes the request body generated by the HLRC to pass the correct field name. This fix is for versions 7.17.6+ (we do not expect to release new versions of HLRC in 8.x).

It also renames the HLRC methods to expose the change to client users.

Co-authored-by: bellengao <bellengao@tencent.com>
2022-08-04 19:12:06 +02:00
Pooya Salehi
b08b30169f
Log more details in TaskAssertions (#88864) (#88881) 2022-07-28 17:55:24 +09:30
Rene Groeschke
62294616df
[7.17] Rework testing conventions gradle plugin (#87213) (#88422)
Backports the following commits to 7.17:
 - Rework testing conventions gradle plugin (#87213)
2022-07-12 10:58:40 +02:00
Rene Groeschke
98d18185ae
[7.17] Setup elasticsearch dependency monitoring with Snyk for production code (#88036) (#88223)
Backports the following commits to 7.17:
 - Setup elasticsearch dependency monitoring with Snyk for production code (#88036)
2022-07-04 08:36:35 +02:00
David Turner
5a12b9d0bf
Avoid WindowsFS in LongGCDisruption (#88110) (#88159)
Closes #87914
2022-06-29 06:28:16 -04:00
David Turner
c2d69e50c5
Specify proper port range in InternalTestCluster (#87885) (#87889)
Today nodes started in an `InternalTestCluster` use `transport.port: 0`
and `http.port: 0` which selects a port from the ephemeral range. This
range is also used by other tests, notably REST tests, and this can lead
to collisions and consequent failures when nodes restart.

This commit restricts the range of ports using the same algorithm as in
`ESTestCase`, avoiding[^1] such collisions.

[^1]: technically this isn't quite enough because the ephemeral range on
some CI workers overlaps the ranges chosen by `ESTestCase`, but that's a
separate issue tracked in #87734

Closes #87448
2022-06-21 11:32:16 -04:00
Alan Woodward
4b1ec9ce30
FastVectorHighlighter should use ValueFetchers to load source data (#87445)
FVH was relying on `SourceLookup.extractRawValues()` to load its data, but this no
longer works for multifields. It should instead use value fetchers which will correctly
locate the input for multifields and/or copy fields.

Fixes #84690
Fixes #82458
Fixes #80895
Fixes #75011
2022-06-08 09:18:14 +01:00
Alan Woodward
b4fab9c823
[7.17] Add a highlighter unit test base class (#85719) (#87413)
The vast majority of our highlighter tests are integration or rest tests, which exercise
the full ES stack but take a long time to run and are difficult to debug. We have a few
unit tests but they are testing very low-level behaviour, and don't interact with the fetch
phase or hit contexts. This commit adds a new HighlighterTestCase base class with some
helper methods that should fill the gap between these two sets of tests. It includes a
method that takes a MapperService, ParsedDocument and SearchSourceBuilder, and then
runs the appropriate highlighter fetch subphase over the resulting hit.
2022-06-07 09:32:21 +01:00
David Turner
21ab79a4fe Improve rejection handling in ThreadedActionListener (#87042)
Today if the submission within `ThreadedActionListener#onResponse` is
rejected from its threadpool then we call `delegate#onFailure` with the
rejection exception on the calling thread. However, if the submission
within `ThreadedActionListener#onFailure` is rejected then we just drop
the listener and log an error.

In most cases completing a listener exceptionally triggers some cleanup
which is often fairly lightweight and therefore safe enough to complete
on the calling thread. In any case it's generally preferable to complete
a listener exceptionally on the wrong thread rather than just dropping
it entirely.

This commit fixes this and adds a test to verify that
`ThreadedActionListener` completes properly even in the face of
rejections.
2022-05-24 09:14:49 +01:00
William Brafford
2ae6150c6b
[Refactor] Use Lists instead of Maps for SystemIndices features (#87004) (#87067)
The SystemIndices constructor should take a list instead of a map as an
argument so that we can guarantee that the map we use for feature lookups is
keyed on the feature name.

We also provide some new getter methods so that calling code does not have to
handle the map directly.
2022-05-23 17:33:28 -04:00