Skip to content

Commit

Permalink
Fix :integ-test:sqlBwcCluster#fullRestartClusterTask on 2.x
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chu <clingzhi@amazon.com>
  • Loading branch information
noCharger committed Aug 6, 2024
1 parent 992e2f5 commit 375b474
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 45 deletions.
7 changes: 7 additions & 0 deletions async-query-core/src/main/antlr/SqlBaseParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ compoundStatement
: statement
| setStatementWithOptionalVarKeyword
| beginEndCompoundBlock
| ifElseStatement
;

setStatementWithOptionalVarKeyword
Expand All @@ -71,6 +72,12 @@ setStatementWithOptionalVarKeyword
LEFT_PAREN query RIGHT_PAREN #setVariableWithOptionalKeyword
;

ifElseStatement
: IF booleanExpression THEN conditionalBodies+=compoundBody
(ELSE IF booleanExpression THEN conditionalBodies+=compoundBody)*
(ELSE elseBody=compoundBody)? END IF
;

singleStatement
: (statement|setResetStatement) SEMICOLON* EOF
;
Expand Down
80 changes: 35 additions & 45 deletions integ-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,6 @@ ext {
cluster.plugin provider((Callable<RegularFile>) (() -> (RegularFile) (() -> downloadedSecurityPlugin)))
}

bwcFilePath = "src/test/resources/bwc/"
bwcMinVersion = "1.1.0.0"
bwcBundleVersion = "1.3.2.0"
bwcBundleTest = (project.findProperty('customDistributionDownloadType') != null &&
project.properties['customDistributionDownloadType'] == "bundle");
bwcVersion = bwcBundleTest ? bwcBundleVersion : bwcMinVersion
// Create bwcVersionShort without the last digit
bwcVersionShort = bwcVersion.substring(0, bwcVersion.lastIndexOf('.'))

bwcOpenSearchJSDownload = 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/' + bwcVersionShort + '/latest/linux/x64/tar/builds/' +
'opensearch/plugins/opensearch-job-scheduler-' + bwcVersion + '.zip'
bwcJobSchedulerPath = bwcFilePath + "job-scheduler/"
}

tasks.withType(licenseHeaders.class) {
Expand All @@ -157,10 +145,6 @@ tasks.withType(licenseHeaders.class) {
validateNebulaPom.enabled = false
loggerUsageCheck.enabled = false

configurations {
zipArchive
}

configurations.all {
resolutionStrategy.force 'junit:junit:4.13.2'
resolutionStrategy.force "commons-logging:commons-logging:1.2"
Expand Down Expand Up @@ -197,9 +181,6 @@ dependencies {
testImplementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.41.2.2'
testImplementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9'
testCompileOnly 'org.apiguardian:apiguardian-api:1.1.2'

// Needed for BWC tests
zipArchive group: 'org.opensearch.plugin', name:'opensearch-job-scheduler', version: "${opensearch_build}"
}

dependencyLicenses.enabled = false
Expand All @@ -222,22 +203,6 @@ testClusters.all {
}
}

def getJobSchedulerPlugin() {
provider(new Callable<RegularFile>() {
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
return configurations.zipArchive.asFileTree.matching {
include '**/opensearch-job-scheduler*'
}.singleFile
}
}
}
})
}

testClusters {
integTest {
testDistribution = 'archive'
Expand Down Expand Up @@ -519,10 +484,20 @@ task comparisonTest(type: RestIntegTestTask) {
systemProperty "queries", System.getProperty("queries")
}

String bwcMinVersion = "1.1.0.0"
String bwcBundleVersion = "1.3.2.0"
Boolean bwcBundleTest = (project.findProperty('customDistributionDownloadType') != null &&
project.properties['customDistributionDownloadType'] == "bundle");
String bwcVersion = bwcBundleTest ? bwcBundleVersion : bwcMinVersion
String currentVersion = opensearch_version.replace("-SNAPSHOT","")
String baseName = "sqlBwcCluster"
String bwcFilePath = "src/test/resources/bwc/"
String bwcJSPluginPath = bwcFilePath + "job-scheduler/"
String bwcSqlPlugin = "opensearch-sql-" + bwcVersion + ".zip"
String bwcRemoteFile = "https://ci.opensearch.org/ci/dbc/bundle-build/1.1.0/20210930/linux/x64/builds/opensearch/plugins/" + bwcSqlPlugin
String bwcJSPlugin = "opensearch-job-scheduler-" + bwcVersion + ".zip"
String bwcRemoteFileRoot = "https://ci.opensearch.org/ci/dbc/bundle-build/1.1.0/20210930/linux/x64/builds/opensearch/plugins/"
String bwcRemoteFileSqlPlugin = bwcRemoteFileRoot + bwcSqlPlugin
String bwcRemoteFileJSPlugin = bwcRemoteFileRoot + bwcJSPlugin

2.times { i ->
testClusters {
Expand Down Expand Up @@ -557,20 +532,21 @@ String bwcRemoteFile = "https://ci.opensearch.org/ci/dbc/bundle-build/1.1.0/2021
}
} else {
versions = ["1.1.0", opensearch_version]
plugin(provider(new Callable<RegularFile>(){
plugin(provider(new Callable<RegularFile>() {
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
if (new File("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion").exists()) {
project.delete(files("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion"))
File dir = new File('./integ-test/' + bwcJSPluginPath + bwcVersion)
if (!dir.exists()) {
dir.mkdirs()
}
project.mkdir bwcJobSchedulerPath + bwcVersion
ant.get(src: bwcOpenSearchJSDownload,
dest: bwcJobSchedulerPath + bwcVersion,
httpusecaches: false)
return fileTree(bwcJobSchedulerPath + bwcVersion).getSingleFile()
File f = new File(dir, bwcJSPlugin)
if (!f.exists()) {
new URL(bwcRemoteFileJSPlugin).withInputStream{ ins -> f.withOutputStream{ it << ins }}
}
return fileTree(bwcJSPluginPath + bwcVersion).getSingleFile()
}
}
}
Expand All @@ -587,7 +563,7 @@ String bwcRemoteFile = "https://ci.opensearch.org/ci/dbc/bundle-build/1.1.0/2021
}
File f = new File(dir, bwcSqlPlugin)
if (!f.exists()) {
new URL(bwcRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }}
new URL(bwcRemoteFileSqlPlugin).withInputStream{ ins -> f.withOutputStream{ it << ins }}
}
return fileTree(bwcFilePath + bwcVersion).getSingleFile()
}
Expand All @@ -601,6 +577,20 @@ String bwcRemoteFile = "https://ci.opensearch.org/ci/dbc/bundle-build/1.1.0/2021
}
}

def getJobSchedulerPlugin() {
provider(new Callable<RegularFile>() {
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
return fileTree(bwcJSPluginPath + project.version).getSingleFile()
}
}
}
})
}

List<Provider<RegularFile>> plugins = [
getJobSchedulerPlugin(),
provider(new Callable<RegularFile>() {
Expand Down

0 comments on commit 375b474

Please sign in to comment.