Skip to content

Commit

Permalink
Fix doc test
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chu <clingzhi@amazon.com>
  • Loading branch information
noCharger committed Jul 18, 2024
1 parent 29d9174 commit bf0eba6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ gen
.worktrees
http-client.env.json
/doctest/sql-cli/
/doctest/opensearch-job-scheduler/
.factorypath
25 changes: 25 additions & 0 deletions doctest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import org.opensearch.gradle.testclusters.RunTask

import java.util.concurrent.Callable

plugins {
id 'base'
id 'com.wiredforcode.spawn'
Expand Down Expand Up @@ -109,6 +111,10 @@ if (version_tokens.length > 1) {
String mlCommonsRemoteFile = 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/' + opensearch_no_snapshot + '/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-ml-' + opensearch_build + '.zip'
String mlCommonsPlugin = 'opensearch-ml'

String bwcOpenSearchJSDownload = 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/' + opensearch_no_snapshot + '/latest/linux/x64/tar/builds/' +
'opensearch/plugins/opensearch-job-scheduler-' + opensearch_build + '.zip'
String jsPlugin = 'opensearch-job-scheduler'

testClusters {
docTestCluster {
// Disable loading of `ML-commons` plugin, because it might be unavailable (not released yet).
Expand All @@ -133,6 +139,25 @@ testClusters {
}
}))
*/
plugin(provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
File dir = new File('./doctest/' + jsPlugin)
if (!dir.exists()) {
dir.mkdirs()
}
File f = new File(dir, jsPlugin + '-' + opensearch_build + '.zip')
if (!f.exists()) {
new URL(bwcOpenSearchJSDownload).withInputStream{ ins -> f.withOutputStream{ it << ins } }
}
return fileTree(jsPlugin).getSingleFile()
}
}
}
}))
plugin ':opensearch-sql-plugin'
testDistribution = 'archive'
}
Expand Down

0 comments on commit bf0eba6

Please sign in to comment.