88 */
99org.elasticsearch.gradle.internal.test.rest.RestTestSuite
1010
11- apply plugin : ' elasticsearch.internal-yaml-rest-test'
1211apply plugin : ' elasticsearch.internal-cluster-test'
12+ apply plugin : ' elasticsearch.internal-yaml-rest-test'
1313apply plugin : ' elasticsearch.internal-java-rest-test'
1414
1515esplugin {
@@ -41,27 +41,46 @@ dependencies {
4141}
4242
4343tasks. named(' check' ) {
44+ // TODO revisit to be the default in ES
4445 dependsOn tasks. withType(Test )
4546}
4647
47-
4848testing {
4949 suites {
5050 configureEach {
51+ // common configuration for all test suites in this project
5152 dependencies {
53+ implementation project()
5254 implementation project(' :test:framework' )
53- implementation project(' :test:fixtures:s3-fixture' )
54- runtimeOnly " org.slf4j:slf4j-simple:${ versions.slf4j} "
55+ runtimeOnly(" org.slf4j:slf4j-simple:${ versions.slf4j} " ) {
56+ // TODO: (Rene) this should be handled by ElasticsearchBase Plugin but there's an open issue with that.
57+ transitive = false
58+ }
59+ }
60+ }
61+ test {
62+ dependencies {
63+ println " adding dependency = dependency"
64+ implementation(project(' :test:fixtures:s3-fixture' ))
5565 }
5666 }
67+ // test suite defined by InternalJavaRestTestPlugin
5768 internalClusterTest {
5869 dependencies {
5970 implementation project(' :test:fixtures:minio-fixture' )
6071 }
72+ targets {
73+ all {
74+ testTask. configure {
75+ // TODO: remove once https://github.com/elastic/elasticsearch/issues/101608 is fixed
76+ systemProperty ' es.insecure_network_trace_enabled' , ' true'
77+ }
78+ }
79+ }
6180 }
81+ // test suite for the java rest tests provided by the InternalJavaRestTestPlugin
6282 javaRestTest {
6383 dependencies {
64- implementation project()
6584 implementation project(' :test:fixtures:aws-fixture-utils' )
6685 implementation project(' :test:fixtures:s3-fixture' )
6786 implementation project(' :test:fixtures:testcontainer-utils' )
@@ -71,6 +90,7 @@ testing {
7190 implementation project(' :test:fixtures:testcontainer-utils' )
7291 }
7392 }
93+ // test suite for the Yaml rest tests provided by the InternalYamlRestTestPlugin
7494 yamlRestTest {
7595 dependencies {
7696 implementation project()
@@ -79,7 +99,66 @@ testing {
7999 implementation project(' :test:fixtures:testcontainer-utils' )
80100 }
81101 }
82-
102+ // Add-hoc test suites require to be passed a type. (usually JvmTestSuite)
103+ webIdentityTokenTest(JvmTestSuite ) {
104+ dependencies {
105+ implementation project(' :server' )
106+ }
107+ targets {
108+ all {
109+ testTask. configure {
110+ systemProperty ' es.allow_insecure_settings' , ' true'
111+ }
112+ }
113+ }
114+ }
115+ insecureCredentialsTest(JvmTestSuite ) {
116+ dependencies {
117+ implementation project(' :server' )
118+ }
119+ targets {
120+ all {
121+ testTask. configure {
122+ systemProperty ' es.allow_insecure_settings' , ' true'
123+ }
124+ }
125+ }
126+ }
127+ s3ThirdPartyTest(JvmTestSuite ) {
128+ dependencies {
129+ implementation project(' :test:fixtures:minio-fixture' )
130+ implementation project(' :server' )
131+ }
132+ targets {
133+ all {
134+ testTask. configure {
135+ boolean useFixture = false
136+ String s3PermanentAccessKey = System . getenv(" amazon_s3_access_key" )
137+ String s3PermanentSecretKey = System . getenv(" amazon_s3_secret_key" )
138+ String s3PermanentBucket = System . getenv(" amazon_s3_bucket" )
139+ String s3PermanentBasePath = System . getenv(" amazon_s3_base_path" )
140+
141+ // If all these variables are missing then we are testing against the MinIO fixture instead, which has the following credentials hard-coded in.
142+ if (! s3PermanentAccessKey && ! s3PermanentSecretKey && ! s3PermanentBucket && ! s3PermanentBasePath) {
143+ useFixture = true
144+ s3PermanentAccessKey = ' s3_test_access_key'
145+ s3PermanentSecretKey = ' s3_test_secret_key'
146+ s3PermanentBucket = ' bucket'
147+ s3PermanentBasePath = ' base_path'
148+ }
149+ println " useFixture = $useFixture "
150+ systemProperty(" tests.use.fixture" , Boolean . toString(useFixture))
151+ systemProperty ' test.s3.account' , s3PermanentAccessKey
152+ systemProperty ' test.s3.key' , s3PermanentSecretKey
153+ systemProperty ' test.s3.bucket' , s3PermanentBucket
154+ nonInputProperties. systemProperty ' test.s3.base' , s3PermanentBasePath + " _third_party_tests_" + buildParams. testSeed
155+
156+ // test container accesses ~/.testcontainers.properties read
157+ systemProperty " tests.security.manager" , " false"
158+ }
159+ }
160+ }
161+ }
83162 }
84163}
85164
@@ -100,12 +179,6 @@ esplugin.bundleSpec.from('config/repository-s3') {
100179 into ' config'
101180}
102181
103- tasks. named(" internalClusterTest" ). configure {
104- // TODO: remove once https://github.com/elastic/elasticsearch/issues/101608 is fixed
105- systemProperty ' es.insecure_network_trace_enabled' , ' true'
106- }
107-
108-
109182tasks. named(" thirdPartyAudit" ). configure {
110183 ignoreMissingClasses(
111184 // classes are missing
0 commit comments