@@ -13,6 +13,7 @@ import org.elasticsearch.gradle.internal.info.BuildParams
13
13
import org.elasticsearch.gradle.internal.test.AntFixture
14
14
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
15
15
import org.elasticsearch.gradle.transform.UnzipTransform
16
+
16
17
import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE
17
18
18
19
apply plugin : ' elasticsearch.jdk-download'
@@ -67,7 +68,7 @@ if (OS.current() == OS.WINDOWS) {
67
68
68
69
int currentMajorVersion = org.elasticsearch.gradle.VersionProperties . elasticsearchVersion. major
69
70
assert (currentMajorVersion - 2 ) == 7 : " add archive BWC tests for major version " + (currentMajorVersion - 2 )
70
- for (String versionString : [' 5.0.0' , ' 5.6.16' , ' 6.0.0' , ' 6.8.23' , ' 7.0.0 ' , ' 7. 17.25' ]) {
71
+ for (String versionString : [' 5.0.0' , ' 5.6.16' , ' 6.0.0' , ' 6.8.23' , ' 7.17.25' ]) {
71
72
Version version = Version . fromString(versionString)
72
73
String packageName = ' org.elasticsearch.distribution.zip'
73
74
String artifact = " ${ packageName} :elasticsearch:${ version} @zip"
@@ -96,41 +97,59 @@ if (OS.current() == OS.WINDOWS) {
96
97
setting ' xpack.searchable.snapshot.shared_cache.region_size' , ' 256KB'
97
98
}
98
99
99
- TaskProvider<AntFixture > fixture = tasks. register(" oldES${ versionNoDots} Fixture" , AntFixture ) {
100
- dependsOn project. configurations. oldesFixture, jdks. legacy, config
101
- executable = " ${ BuildParams.runtimeJavaHome} /bin/java"
102
- env ' CLASSPATH' , " ${ -> project.configurations.oldesFixture.asPath} "
103
- // old versions of Elasticsearch need JAVA_HOME
104
- env ' JAVA_HOME' , jdks. legacy. javaHomePath
105
- // If we are running on certain arm systems we need to explicitly set the stack size to overcome JDK page size bug
106
- if (Architecture . current() == Architecture . AARCH64 ) {
107
- env ' ES_JAVA_OPTS' , ' -Xss512k'
108
- }
109
- def dataPath = " ${ baseDir} /data"
110
- args ' oldes.OldElasticsearch' ,
111
- baseDir,
112
- " ${ -> config.getSingleFile().toPath()} " ,
113
- false ,
114
- " path.repo: ${ repoLocation} " ,
115
- " path.data: ${ dataPath} "
116
- if ((version. onOrAfter(' 6.8.0' ) && Architecture . current() == Architecture . AARCH64 ) || (version. onOrAfter(" 6.4.0" ) && BwcVersions . isMlCompatible(version) == false )) {
117
- // We need to explicitly disable ML when running old ES versions on ARM or on systems with newer GLIBC
118
- args ' xpack.ml.enabled: false'
119
- }
120
- doFirst {
121
- delete(dataPath)
122
- mkdir(dataPath)
100
+ if (version. onOrAfter(' 7.0.0' )) {
101
+ def oldCluster = testClusters. register(" oldES${ versionNoDots} Cluster" ) {
102
+ testDistribution = ' DEFAULT'
103
+ numberOfNodes = 1
104
+ versions = [versionString]
105
+ setting ' path.repo' , repoLocation, IGNORE_VALUE
106
+ setting ' xpack.license.self_generated.type' , ' trial'
107
+ setting ' xpack.security.enabled' , ' true'
108
+ user username : ' admin' , password : ' admin-password' , role : ' superuser'
109
+ setting ' xpack.searchable.snapshot.shared_cache.size' , ' 16MB'
110
+ setting ' xpack.searchable.snapshot.shared_cache.region_size' , ' 256KB'
123
111
}
124
- maxWaitInSeconds 60
125
- waitCondition = { fixture , ant ->
126
- // the fixture writes the ports file when Elasticsearch's HTTP service
127
- // is ready, so we can just wait for the file to exist
128
- return fixture. portsFile. exists()
112
+ } else {
113
+ TaskProvider<AntFixture > fixture = tasks. register(" oldES${ versionNoDots} Fixture" , AntFixture ) {
114
+ dependsOn project. configurations. oldesFixture, jdks. legacy, config
115
+ executable = " ${ BuildParams.runtimeJavaHome} /bin/java"
116
+ env ' CLASSPATH' , " ${ -> project.configurations.oldesFixture.asPath} "
117
+ // old versions of Elasticsearch need JAVA_HOME
118
+ env ' JAVA_HOME' , jdks. legacy. javaHomePath
119
+ // If we are running on certain arm systems we need to explicitly set the stack size to overcome JDK page size bug
120
+ if (Architecture . current() == Architecture . AARCH64 ) {
121
+ env ' ES_JAVA_OPTS' , ' -Xss512k'
122
+ }
123
+ def dataPath = " ${ baseDir} /data"
124
+ args ' oldes.OldElasticsearch' ,
125
+ baseDir,
126
+ " ${ -> config.getSingleFile().toPath()} " ,
127
+ false ,
128
+ " path.repo: ${ repoLocation} " ,
129
+ " path.data: ${ dataPath} "
130
+ if ((version. onOrAfter(' 6.8.0' ) && Architecture . current() == Architecture . AARCH64 ) || (version. onOrAfter(" 6.4.0" ) && BwcVersions . isMlCompatible(version) == false )) {
131
+ // We need to explicitly disable ML when running old ES versions on ARM or on systems with newer GLIBC
132
+ args ' xpack.ml.enabled: false'
133
+ }
134
+ doFirst {
135
+ delete(dataPath)
136
+ mkdir(dataPath)
137
+ }
138
+ maxWaitInSeconds 60
139
+ waitCondition = { fixture , ant ->
140
+ // the fixture writes the ports file when Elasticsearch's HTTP service
141
+ // is ready, so we can just wait for the file to exist
142
+ return fixture. portsFile. exists()
143
+ }
129
144
}
130
145
}
131
146
132
147
tasks. register(" javaRestTestBeforeRestart#${ versionNoDots} " , StandaloneRestIntegTestTask ) {
133
- useCluster testClusterProvider
148
+ if (version. onOrAfter(' 7.0.0' )) {
149
+ useCluster testClusters. named(" oldES${ versionNoDots} Cluster" )
150
+ } else {
151
+ dependsOn tasks. named(" oldES${ versionNoDots} Fixture" )
152
+ }
134
153
dependsOn fixture
135
154
doFirst {
136
155
delete(repoLocation)
@@ -151,13 +170,25 @@ if (OS.current() == OS.WINDOWS) {
151
170
}
152
171
153
172
tasks. matching { it. name. startsWith(" javaRestTest" ) && it. name. endsWith(versionNoDots) }. configureEach {
173
+ doFirst {
174
+ def oldClusterPortProvider = testClusters. named(" oldES${ versionNoDots} Cluster" ). map { cluster ->
175
+ def local = cluster. allHttpSocketURI. find { it. startsWith(" 127.0.0.1" )}
176
+ return local. substring(local. lastIndexOf(' :' ) + 1 )
177
+ }
178
+ it. nonInputProperties. systemProperty " tests.es.port" , " ${ -> oldClusterPortProvider.get()} "
179
+ println " oldClusterPortProvider " + oldClusterPortProvider. get()
180
+ println " allRemoteAccessPortURI " + testClusters. named(" oldES${ versionNoDots} Cluster" ). get(). allRemoteAccessPortURI
181
+ println " allHttpSocketURI " + testClusters. named(" oldES${ versionNoDots} Cluster" ). get(). allHttpSocketURI
182
+ println " httpSocketURI " + testClusters. named(" oldES${ versionNoDots} Cluster" ). get(). httpSocketURI
183
+ }
154
184
it. nonInputProperties. systemProperty " tests.repo.location" , repoLocation
155
185
it. systemProperty " tests.es.version" , version. toString()
156
186
157
187
/* Use a closure on the string to delay evaluation until right before we
158
188
* run the integration tests so that we can be sure that the file is
159
189
* ready. */
160
- it. nonInputProperties. systemProperty " tests.es.port" , " ${ -> fixture.get().addressAndPort} "
190
+ // it.nonInputProperties.systemProperty "tests.es.port", "${-> fixture.get().addressAndPort}"
191
+ // it.nonInputProperties.systemProperty "tests.es.port", "${-> testClusters.named("oldES${versionNoDots}Cluster").get().allRemoteAccessPortURI.join(',')}"
161
192
it. nonInputProperties. systemProperty(' tests.rest.cluster' , " ${ -> testClusterProvider.get().allHttpSocketURI.join(",")} " )
162
193
it. nonInputProperties. systemProperty(' tests.clustername' , " ${ -> testClusterProvider.get().getName()} " )
163
194
}
0 commit comments