Commit graph

216 commits

Author SHA1 Message Date
David Turner
49f27e39ea
Migrate discovery-ec2 QA tests to javaRestTest (#119384)
No need for all this Gradle magic any more, we can just test the
discovery behaviour directly using Java REST tests.
2025-01-21 21:20:19 +11:00
Yang Wang
7f3e7773d6
[Test] Fix testcontainers wait for Minio (#120175)
This PR changes the wait strategy from the default HostPortWaitStrategy
to LogMessageWaitStrategy to accommodate the change in the latest Minio
docker image.

The default HostPortWaitStrategy has two issues: 1. It assumes certain
Linux commands such as grep and nc available    inside the container.
This is not the case for the latest version of    Minio docker image
which does not have either of the commands. 2. The first item on their
own is not fatal since the check also falls    back on just reading the
listening port as a file with    `/bin/bash -c
'</dev/tcp/localhost/9000'`. However, the command    stirng is build
using the system's current locale which may not be    Engilsh and can
have different symbols for print integers like 9000.    This completely
breaks the command and in turn leads to total failure    of the wait
check.

There is no easy fix for the above issues nor do I think it is necessary
to fix. So the PR simply switches the wait strategy to be log message
based.

Resolves: #120101 Resolves: #120115 Resolves: #120117 Resolves: #118548
2025-01-16 22:01:14 +11:00
Yang Wang
60a54e6ab7
[Test] Upgrade minio docker image used for tests (#120086)
This PR upgrades the minio docker image from
RELEASE.2021-03-01T04-20-55Z which is 3+ years old to the latest
RELEASE.2024-12-18T13-15-44Z.

Relates: #118548
2025-01-14 21:38:09 +11:00
Nick Tindall
0dbe0344f1
Implement CAS support for GCP test fixture (#118236)
Closes ES-5679
2025-01-06 17:12:36 +11:00
Rene Groeschke
957064b279
[Build] Update krb5kdc test fixture base image and krb5 library (#119403) 2025-01-02 23:02:24 +00:00
David Turner
34ec706f2e
Enhance Ec2ImdsHttpHandler (#119334)
- Require IMDSv1 if using alternative endpoints (i.e. ECS)
- Forbid profile name lookup with alternative endpoints
- Add token TTL header for IMDSv2
- Add support for instance-identity docs
2024-12-31 21:24:02 +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
David Turner
a4d4762802
Introduce aws-fixture-utils (#119319)
Extracts some common utils for creating AWS service test fixtures out of
the `s3-fixture` module and into a separate library independent of S3.
2024-12-27 18:58:07 +00:00
Rene Groeschke
e741fd62cd
[Build] Build hdfs fixture faster and less (#118801)
The building of the shadowed hdfs2 and hdfs3 fixtures takes quite long time due to being 51 and 80mb in size.
By removing non used dependencies from the shadow jar creation we can speed up this significantly.
Also we avoid building hdfs fixture jars now for compile only (resulting in no shadow jar creation for precommit checks)
2024-12-18 18:30:36 +00:00
Nick Tindall
a6dcaee419
Add test for GCS fixture (#118737)
Relates: ES-5679
2024-12-18 11:58:16 +11:00
David Turner
59690f5e67
Add integ test for EC2 special network addresses (#118560)
Replaces the `Ec2NetworkTests` unit test suite with an integ test suite
to cover the resolution process end-to-end.
2024-12-13 07:30:57 +11:00
David Turner
a975927320
Add discovery-ec2 integration test for AZ attr (#118452)
Verifies that the plugin sets the `aws_availability_zone` automatically
by reading the AZ name from the IMDS at startup.
2024-12-12 10:57:57 +00:00
David Turner
9dcd9751f4
Add IMDSv2 support to repository-s3 (#117748)
The version of the AWS Java SDK we use already magically switches to
IMDSv2 if available, but today we cannot claim to support IMDSv2 in
Elasticsearch since we have no tests demonstrating that the magic really
works for us. In particular, this sort of thing often risks falling foul
of some restrictions imposed by the security manager (if not now then
maybe in some future release).

This commit adds proper support for IMDSv2 by enhancing the test suite
to add the missing coverage to avoid any risk of breaking this magical
SDK behaviour in future.

Closes #105135 Closes ES-9984
2024-12-02 20:01:48 +11:00
Nick Tindall
c74c06daee
Deduplicate Range header parsing (#117304) 2024-11-30 11:33:20 +11:00
David Turner
c3f9e01723
Migrate repository-s3 YAML tests to Java REST tests (#117628)
Today these YAML tests rely on a bunch of rather complex setup organised
by Gradle, and contain lots of duplication and coincident strings,
mostly because that was the only way to achieve what we wanted before we
could orchestrate test clusters and fixtures directly from Java test
suites. We're not actually running the YAML tests in ways that take
advantage of their YAMLness (e.g. in mixed-version clusters, or from
other client libraries).

This commit replaces these tests with Java REST tests which enormously
simplifies this area of code.

Relates ES-9984
2024-11-29 20:58:09 +11:00
Yang Wang
24bc505e28
[Test] Increase test secret key length (#117675)
Running with FIPS approved mode requires secret keys to be at least 114
bits long.

Relates: #117324 Resolves: #117596 Resolves: #117709 Resolves: #117710
Resolves: #117711 Resolves: #117712
2024-11-29 14:07:48 +11:00
Nick Tindall
56637285a8
Implement CAS support in Azure test fixture (#117104)
Closes ES-5680
2024-11-29 13:47:40 +11:00
David Turner
b13e0d25c0
Support dynamic credentials in S3HttpFixture (#117458)
Rephrase the authorization check in `S3HttpFixture` in terms of a
predicate provided by the caller so that there's no need for a separate
subclass that handles session tokens, and so that it can support
auto-generated credentials more naturally.

Also adapts `Ec2ImdsHttpFixture` to dynamically generate credentials
this way.

Also extracts the STS fixture in `S3HttpFixtureWithSTS` into a separate
service, similarly to #117324, and adapts this new fixture to
dynamically generate credentials too.

Relates ES-9984
2024-11-26 09:06:02 +00:00
David Turner
b0c49766f6
Extract IMDS test fixture from S3 fixture (#117324)
The S3 and IMDS services are separate things in practice, we shouldn't
be conflating them as we do today. This commit introduces a new
independent test fixture just for the IMDS endpoint and migrates the
relevant tests to use it.

Relates ES-9984
2024-11-25 08:01:21 +00:00
David Turner
f9223531ac
Enable test-fixture test suites (#117329)
Today the `:test:fixtures` modules' test suites are disabled, but in
fact these fixtures do have nontrivial behaviour that wants testing in
its own right, so we should run their tests.

This commit reinstates the disabled tests and fixes one which should
have been fixed as part of #116212.
2024-11-22 13:14:26 +00:00
Sam Xiao
ccdc562778
Azure Fixture: Add additional batch delete path (#116985)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-11-20 17:30:52 +01:00
Rene Groeschke
def490ef85
[Gradle] Update shadow plugin (#116826)
- The shadow plugin has changed ownership and plugin id.
- Make some formatting of poms more reproducible
2024-11-15 19:07:46 +01:00
David Turner
f2ac0ed657
Add end-to-end test for reloading S3 credentials (#116762)
We don't seem to have a test that completely verifies that a S3
repository can reload credentials from an updated keystore. This commit
adds such a test.
2024-11-14 08:28:44 +00:00
David Turner
0c4209b5ef
Handle status code 0 in S3 CMU response (#116212)
A `CompleteMultipartUpload` action may fail after sending the `200 OK`
response line. In this case the response body describes the error, and
the SDK translates this situation to an exception with status code 0 but
with the `ErrorCode` string set appropriately. This commit enhances the
exception handling in `S3BlobContainer` to handle this possibility.

Closes #102294

Co-authored-by: Pat Patterson <metadaddy@gmail.com>
2024-11-05 09:27:56 +00:00
Ryan Ernst
e5d5c17c99
Use directory name as project name for libs (#115720)
The libs projects are configured to all begin with `elasticsearch-`.
While this is desireable for the artifacts to contain this consistent
prefix, it means the project names don't match up with their
directories. Additionally, it creates complexities for subproject naming
that must be manually adjusted.

This commit adjusts the project names for those under libs to be their
directory names. The resulting artifacts for these libs are kept the
same, all beginning with `elasticsearch-`.
2024-10-29 13:02:28 -07:00
Nick Tindall
7599d4cf43
Use Azure blob batch API to delete blobs in batches (#114566)
Closes ES-9777
2024-10-24 19:51:52 +11:00
Joe Gallo
69054ac83b
Download IPinfo ip location databases (#114847) 2024-10-15 17:59:38 -05:00
Mark Vieira
a59c182f9f
Add AGPLv3 as a supported license 2024-09-13 15:29:46 -07:00
David Turner
e6b830e3b3
Clean up dangling S3 multipart uploads (#111955)
If Elasticsearch fails part-way through a multipart upload to S3 it will
generally try and abort the upload, but it's possible that the abort
attempt also fails. In this case the upload becomes _dangling_. Dangling
uploads consume storage space, and therefore cost money, until they are
eventually aborted.

Earlier versions of Elasticsearch require users to check for dangling
multipart uploads, and to manually abort any that they find. This commit
introduces a cleanup process which aborts all dangling uploads on each
snapshot delete instead.

Closes #44971 Closes #101169
2024-08-20 02:49:48 +10:00
David Turner
7ed83fd129
Fix Azure tests in FIPS mode again (#111611)
Closes #111345 Closes #111607 Closes #111608
2024-08-06 21:33:29 +10:00
Nikolaj Volgushev
4c782f7ca8
Tests for Azure Workload Identity support (#111414)
This PR builds on https://github.com/elastic/elasticsearch/pull/111344
to test support for Azure Workload Identity authentication. 

Relates: https://github.com/elastic/elasticsearch/issues/111346
2024-08-05 22:07:25 +10:00
Rene Groeschke
5b88264d93
[Gradle] Fix lazy task configuration regression (#111506) 2024-08-01 20:02:21 +10:00
David Turner
3b61cbfbe5
Add support for Azure Managed Identity (#111344)
With this commit, if no key or SAS token is supplied for an Azure
repository then Elasticsearch will use the `DefaultAzureCredential`
chain defined in the Azure SDK, which will obtain credentials from the
instance metadata service when running on an Azure VM.
2024-07-30 08:33:25 +01:00
David Turner
ea208d1924
Follow-up to Azure auth validation change (#111252)
Arising from a post-merge review of #111242
2024-07-25 08:54:14 +01:00
David Turner
97f6294531
Validate Authorization header in Azure test fixture (#111242)
Today the Azure test fixture accepts all requests, but we should be
checking that the `Authorization` header is at least present and
approximately correct. This commit adds support for this check.
2024-07-24 19:03:52 +01:00
David Turner
d69fd44005
Add HTTPS support to AzureHttpFixture (#111228)
Some soon-to-be-added authentication mechanisms are not supported over
plain HTTP. This commit adds HTTPS support to the internal fixture, and
adopts its use in all the real-cluster tests which use it.
2024-07-24 12:48:32 +01:00
Rene Groeschke
983a3b3875
Extend timeout of Krb5kDcContainer test container startup (#111198)
- testcontainer startup timeout defaults to 60s and we see ocassionally this fixture
taking longer to startup in certain environments

fixes #111140
2024-07-24 01:04:11 +10:00
Keith Massey
e8fd22fb36
Avoid calling real maxmind endpoint from EnterpriseGeoIpDownloader #111120 (#111121)
If the geoip_use_service system property is set to true, then the
EnterpriseGeoIpHttpFixture is disabled, so EnterpriseGeoIpDownloader
incorrectly calls maxmind.com without credentials, and fails. This
change makes it so that the maxmind server is never called from tests.
Closes https://github.com/elastic/elasticsearch/issues/111002
2024-07-23 04:33:58 +10:00
Joe Gallo
27e7601698
Directly download commercial ip geolocation databases from providers (#110844)
Co-authored-by: Keith Massey <keith.massey@elastic.co>
2024-07-17 20:55:14 -04:00
Volodymyr Krasnikov
2ef87b8eec
Implement RequestedRangeNotSatisfiedException for Azure and GCP (#110401)
* Implement RequestedRangeNotSatisfiedException for Azure and GCP

* spotless

* rename test

* Generalize 3rd party tests for 3 cloud blob containers

* Follow comments

* minimize changes with main

* Follow comments 2
2024-07-15 09:09:37 -07:00
Rene Groeschke
4a0b026276
Fix krb5 fixture classpath (#109962)
* Fix krb5dc fixture classpath and handling
2024-06-20 13:01:35 +02:00
Rene Groeschke
00f4c1320f
Revert "Fix classpath for :test:fixtures:krb5kdc-fixture:cacheTestFixtures (#109952)" (#109960)
This reverts commit 674fea275b.
2024-06-20 12:33:31 +02:00
Rene Groeschke
674fea275b
Fix classpath for :test:fixtures:krb5kdc-fixture:cacheTestFixtures (#109952) 2024-06-20 12:28:06 +02:00
Rene Groeschke
76f142f454
Skip rest tests when hdfs cluster setup fails (#106856)
For now skip tests when flaky hdfs cluster cannot be started. Investigating further without
bothering others and keeping pipeline green
2024-03-28 10:02:20 +01:00
Rene Groeschke
13f4b91ffd
Preemptively create hdfs data folder in test fixture (#106823)
Potentially addresses flaky test as described here:
https://github.com/elastic/elasticsearch/issues/106739 We see that the
data folder sometimes is created with wrong permissions. Now we try to
fix that by creating that folder preemptively as part of the fixture
setup.
2024-03-27 12:17:10 -04:00
Rene Groeschke
8f3c4108f3
Make HdfsFixture startup more robust (#106777) 2024-03-27 06:07:38 +01:00
Rene Groeschke
b39b3731a7
Port krb5kdc to test container and rework hdfs handling (#106228)
This ports our krb5kdc test fixture to test container and reworks hdfs handling to also be based on test containers.
The yaml rest tests that are using hdfs required introducing variable substitution in yamlresttestparser handling.
2024-03-26 08:39:39 +01:00
Rene Groeschke
76d19749a4
Add gradle plugin for publishing docker based test fixtures (#106229)
To make those docker images available for our testcontainer based
fixtures we need to publish them on a regular basis to ensure the source
and the images are in sync. This adds some convenience plugin to take
care of publishing our docker test fixtures
2024-03-21 12:29:38 -04:00
Tanguy Leroux
1e0df87328
Fix S3HttpHandler bytes range requests support (#106180)
This change fixes the S3HttpHandler so that it supports range byte
requests with ending offsets that can be larger than the blob length.

This is something that is supported today by S3 and the current
version of the AWS SDK we use can also set an ending offset to
a very large value (Long.MAX_VALUE).

This change also adds support for trappy situation where the
starting offset is also larger than the bob length.
2024-03-18 11:43:30 +01:00
Tanguy Leroux
c7f79f47ed
Fix AzureHttpHandler bytes range requests support (#106182)
Fixes the AzureHttpHandler so that it supports range byte requests 
with ending offsets that go beyond the real blob length, like the real 
Azure service supports.
2024-03-18 09:17:45 +01:00