Skip to content

Commit 90f2873

Browse files
Optimize downloading.
Signed-off-by: Yury-Fridlyand <[email protected]>
1 parent 3bf1133 commit 90f2873

File tree

4 files changed

+19
-104
lines changed

4 files changed

+19
-104
lines changed

integ-test/build.gradle

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ testClusters.integTest {
154154
setting "plugins.query.datasources.encryption.masterkey", "1234567812345678"
155155
}
156156

157-
boolean securityPluginDownloaded = false
157+
File downloadedSecurityPlugin = null
158158

159159
testClusters {
160160
remoteCluster {
@@ -167,9 +167,25 @@ testClusters {
167167
}
168168

169169
var projectAbsPath = projectDir.getAbsolutePath()
170+
171+
// add a check to avoid re-downloading multiple times during single test run
172+
if (downloadedSecurityPlugin == null) {
173+
downloadedSecurityPlugin = Paths.get(projectAbsPath, 'bin', 'opensearch-security-snapshot.zip').toFile()
174+
download.run {
175+
src getSecurityPluginDownloadLink()
176+
dest downloadedSecurityPlugin
177+
}
178+
}
179+
170180
// Config below including files are copied from security demo configuration
171181
['esnode.pem', 'esnode-key.pem', 'root-ca.pem'].forEach { file ->
172-
extraConfigFile file, Paths.get(projectAbsPath, 'rc', file).toFile()
182+
File local = Paths.get(projectAbsPath, 'bin', file).toFile()
183+
download.run {
184+
src "https://raw.githubusercontent.com/opensearch-project/security/main/bwc-test/src/test/resources/security/" + file
185+
dest local
186+
overwrite false
187+
}
188+
extraConfigFile file, local
173189
}
174190
setting 'plugins.security.ssl.transport.pemcert_filepath', 'esnode.pem'
175191
setting 'plugins.security.ssl.transport.pemkey_filepath', 'esnode-key.pem'
@@ -192,28 +208,7 @@ testClusters {
192208
setting 'plugins.security.system_indices.enabled', 'true'
193209

194210
plugin ":opensearch-sql-plugin"
195-
plugin provider(new Callable<RegularFile>(){
196-
197-
@Override
198-
RegularFile call() throws Exception {
199-
return new RegularFile() {
200-
201-
@Override
202-
File getAsFile() {
203-
var target = Paths.get(projectAbsPath, 'bin', 'opensearch-security-snapshot.zip').toFile()
204-
// add a check to avoid re-downloading multiple times during single test run
205-
if (!securityPluginDownloaded) {
206-
download.run {
207-
src getSecurityPluginDownloadLink()
208-
dest target
209-
}
210-
securityPluginDownloaded = true
211-
}
212-
return target
213-
}
214-
}
215-
}
216-
})
211+
plugin provider((Callable<RegularFile>) (() -> (RegularFile) (() -> downloadedSecurityPlugin)))
217212
}
218213
}
219214

integ-test/rc/esnode-key.pem

Lines changed: 0 additions & 28 deletions
This file was deleted.

integ-test/rc/esnode.pem

Lines changed: 0 additions & 28 deletions
This file was deleted.

integ-test/rc/root-ca.pem

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)