Skip to content

Commit

Permalink
use notiifcation snapshot for integ test (opensearch-project#822)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Agrawal <[email protected]>
  • Loading branch information
lezzago authored Mar 3, 2023
1 parent 271caf9 commit fc1ecb0
Showing 1 changed file with 20 additions and 50 deletions.
70 changes: 20 additions & 50 deletions alerting/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ configurations.testImplementation {
exclude module: "securemock"
}

configurations {
zipArchive
}

dependencies {
// Needed for integ tests
zipArchive group: 'org.opensearch.plugin', name:'opensearch-notifications-core', version: "${opensearch_build}"
zipArchive group: 'org.opensearch.plugin', name:'notifications', version: "${opensearch_build}"

compileOnly "org.opensearch.plugin:opensearch-scripting-painless-spi:${versions.opensearch}"
api "org.opensearch.plugin:percolator-client:${opensearch_version}"

Expand Down Expand Up @@ -135,12 +143,6 @@ integTest.getClusters().forEach{c -> c.plugin(project.getObjects().fileProperty(

def _numNodes = findProperty('numNodes') as Integer ?: 1

String notificationsFilePath = "src/test/resources/notifications"
String notificationsCoreFilePath = "src/test/resources/notifications-core"
String notificationsPlugin = "opensearch-notifications-" + plugin_no_snapshot + ".zip"
String notificationsCorePlugin = "opensearch-notifications-core-" + plugin_no_snapshot + ".zip"
String notificationsRemoteFile = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + opensearch_no_snapshot + "/latest/linux/x64/tar/builds/opensearch/plugins/" + notificationsPlugin
String notificationsCoreRemoteFile = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + opensearch_no_snapshot + "/latest/linux/x64/tar/builds/opensearch/plugins/" + notificationsCorePlugin
testClusters.integTest {
testDistribution = "ARCHIVE"
// Cluster shrink exception thrown if we try to set numberOfNodes to 1, so only apply if > 1
Expand All @@ -160,17 +162,9 @@ testClusters.integTest {
new RegularFile() {
@Override
File getAsFile() {
File dir = new File(rootDir.path + "/alerting/" + notificationsCoreFilePath)

if (!dir.exists()) {
dir.mkdirs()
}

File f = new File(dir, notificationsCorePlugin)
if (!f.exists()) {
new URL(notificationsCoreRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }}
}
fileTree(notificationsCoreFilePath).getSingleFile()
return configurations.zipArchive.asFileTree.matching {
include '**/opensearch-notifications-core*'
}.singleFile
}
}
}))
Expand All @@ -179,17 +173,9 @@ testClusters.integTest {
new RegularFile() {
@Override
File getAsFile() {
File dir = new File(rootDir.path + "/alerting/" + notificationsFilePath)

if (!dir.exists()) {
dir.mkdirs()
}

File f = new File(dir, notificationsPlugin)
if (!f.exists()) {
new URL(notificationsRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }}
}
fileTree(notificationsFilePath).getSingleFile()
return configurations.zipArchive.asFileTree.matching {
include '**/notifications*'
}.singleFile
}
}
}))
Expand Down Expand Up @@ -343,35 +329,19 @@ task prepareBwcTests {
new RegularFile() {
@Override
File getAsFile() {
File dir = new File(rootDir.path + "/alerting/" + notificationsCoreFilePath)

if (!dir.exists()) {
dir.mkdirs()
}

File f = new File(dir, notificationsCorePlugin)
if (!f.exists()) {
new URL(notificationsCoreRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }}
}
fileTree(notificationsCoreFilePath).getSingleFile()
return configurations.zipArchive.asFileTree.matching {
include '**/opensearch-notifications-core*'
}.singleFile
}
}
}),
provider({
new RegularFile() {
@Override
File getAsFile() {
File dir = new File(rootDir.path + "/alerting/" + notificationsFilePath)

if (!dir.exists()) {
dir.mkdirs()
}

File f = new File(dir, notificationsPlugin)
if (!f.exists()) {
new URL(notificationsRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }}
}
fileTree(notificationsFilePath).getSingleFile()
return configurations.zipArchive.asFileTree.matching {
include '**/notifications*'
}.singleFile
}
}
})
Expand Down

0 comments on commit fc1ecb0

Please sign in to comment.