8
8
*/
9
9
org.elasticsearch.gradle.internal.test.rest.RestTestSuite
10
10
11
- apply plugin : ' elasticsearch.internal-yaml-rest-test'
12
11
apply plugin : ' elasticsearch.internal-cluster-test'
12
+ apply plugin : ' elasticsearch.internal-yaml-rest-test'
13
13
apply plugin : ' elasticsearch.internal-java-rest-test'
14
14
15
15
esplugin {
@@ -41,27 +41,46 @@ dependencies {
41
41
}
42
42
43
43
tasks. named(' check' ) {
44
+ // TODO revisit to be the default in ES
44
45
dependsOn tasks. withType(Test )
45
46
}
46
47
47
-
48
48
testing {
49
49
suites {
50
50
configureEach {
51
+ // common configuration for all test suites in this project
51
52
dependencies {
53
+ implementation project()
52
54
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' ))
55
65
}
56
66
}
67
+ // test suite defined by InternalJavaRestTestPlugin
57
68
internalClusterTest {
58
69
dependencies {
59
70
implementation project(' :test:fixtures:minio-fixture' )
60
71
}
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
+ }
61
80
}
81
+ // test suite for the java rest tests provided by the InternalJavaRestTestPlugin
62
82
javaRestTest {
63
83
dependencies {
64
- implementation project()
65
84
implementation project(' :test:fixtures:aws-fixture-utils' )
66
85
implementation project(' :test:fixtures:s3-fixture' )
67
86
implementation project(' :test:fixtures:testcontainer-utils' )
@@ -71,6 +90,7 @@ testing {
71
90
implementation project(' :test:fixtures:testcontainer-utils' )
72
91
}
73
92
}
93
+ // test suite for the Yaml rest tests provided by the InternalYamlRestTestPlugin
74
94
yamlRestTest {
75
95
dependencies {
76
96
implementation project()
@@ -79,7 +99,66 @@ testing {
79
99
implementation project(' :test:fixtures:testcontainer-utils' )
80
100
}
81
101
}
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
+ }
83
162
}
84
163
}
85
164
@@ -100,12 +179,6 @@ esplugin.bundleSpec.from('config/repository-s3') {
100
179
into ' config'
101
180
}
102
181
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
-
109
182
tasks. named(" thirdPartyAudit" ). configure {
110
183
ignoreMissingClasses(
111
184
// classes are missing
0 commit comments