Skip to content

Commit

Permalink
Optimize downloading.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Aug 9, 2023
1 parent 3bf1133 commit 90f2873
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 104 deletions.
43 changes: 19 additions & 24 deletions integ-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ testClusters.integTest {
setting "plugins.query.datasources.encryption.masterkey", "1234567812345678"
}

boolean securityPluginDownloaded = false
File downloadedSecurityPlugin = null

testClusters {
remoteCluster {
Expand All @@ -167,9 +167,25 @@ testClusters {
}

var projectAbsPath = projectDir.getAbsolutePath()

// add a check to avoid re-downloading multiple times during single test run
if (downloadedSecurityPlugin == null) {
downloadedSecurityPlugin = Paths.get(projectAbsPath, 'bin', 'opensearch-security-snapshot.zip').toFile()
download.run {
src getSecurityPluginDownloadLink()
dest downloadedSecurityPlugin
}
}

// Config below including files are copied from security demo configuration
['esnode.pem', 'esnode-key.pem', 'root-ca.pem'].forEach { file ->
extraConfigFile file, Paths.get(projectAbsPath, 'rc', file).toFile()
File local = Paths.get(projectAbsPath, 'bin', file).toFile()
download.run {
src "https://raw.githubusercontent.com/opensearch-project/security/main/bwc-test/src/test/resources/security/" + file
dest local
overwrite false
}
extraConfigFile file, local
}
setting 'plugins.security.ssl.transport.pemcert_filepath', 'esnode.pem'
setting 'plugins.security.ssl.transport.pemkey_filepath', 'esnode-key.pem'
Expand All @@ -192,28 +208,7 @@ testClusters {
setting 'plugins.security.system_indices.enabled', 'true'

plugin ":opensearch-sql-plugin"
plugin provider(new Callable<RegularFile>(){

@Override
RegularFile call() throws Exception {
return new RegularFile() {

@Override
File getAsFile() {
var target = Paths.get(projectAbsPath, 'bin', 'opensearch-security-snapshot.zip').toFile()
// add a check to avoid re-downloading multiple times during single test run
if (!securityPluginDownloaded) {
download.run {
src getSecurityPluginDownloadLink()
dest target
}
securityPluginDownloaded = true
}
return target
}
}
}
})
plugin provider((Callable<RegularFile>) (() -> (RegularFile) (() -> downloadedSecurityPlugin)))
}
}

Expand Down
28 changes: 0 additions & 28 deletions integ-test/rc/esnode-key.pem

This file was deleted.

28 changes: 0 additions & 28 deletions integ-test/rc/esnode.pem

This file was deleted.

24 changes: 0 additions & 24 deletions integ-test/rc/root-ca.pem

This file was deleted.

0 comments on commit 90f2873

Please sign in to comment.