Skip to content

Commit b7ad445

Browse files
committed
use notiifcation snapshot for integ test
Signed-off-by: Ashish Agrawal <[email protected]>
1 parent 271caf9 commit b7ad445

File tree

1 file changed

+20
-50
lines changed

1 file changed

+20
-50
lines changed

alerting/build.gradle

Lines changed: 20 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,15 @@ configurations.testImplementation {
9090
exclude module: "securemock"
9191
}
9292

93+
configurations {
94+
zipArchive
95+
}
96+
9397
dependencies {
98+
// Needed for integ tests
99+
zipArchive group: 'org.opensearch.plugin', name:'opensearch-notifications-core', version: "${opensearch_build}"
100+
zipArchive group: 'org.opensearch.plugin', name:'notifications', version: "${opensearch_build}"
101+
94102
compileOnly "org.opensearch.plugin:opensearch-scripting-painless-spi:${versions.opensearch}"
95103
api "org.opensearch.plugin:percolator-client:${opensearch_version}"
96104

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

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

138-
String notificationsFilePath = "src/test/resources/notifications"
139-
String notificationsCoreFilePath = "src/test/resources/notifications-core"
140-
String notificationsPlugin = "opensearch-notifications-" + plugin_no_snapshot + ".zip"
141-
String notificationsCorePlugin = "opensearch-notifications-core-" + plugin_no_snapshot + ".zip"
142-
String notificationsRemoteFile = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + opensearch_no_snapshot + "/latest/linux/x64/tar/builds/opensearch/plugins/" + notificationsPlugin
143-
String notificationsCoreRemoteFile = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + opensearch_no_snapshot + "/latest/linux/x64/tar/builds/opensearch/plugins/" + notificationsCorePlugin
144146
testClusters.integTest {
145147
testDistribution = "ARCHIVE"
146148
// Cluster shrink exception thrown if we try to set numberOfNodes to 1, so only apply if > 1
@@ -160,17 +162,9 @@ testClusters.integTest {
160162
new RegularFile() {
161163
@Override
162164
File getAsFile() {
163-
File dir = new File(rootDir.path + "/alerting/" + notificationsCoreFilePath)
164-
165-
if (!dir.exists()) {
166-
dir.mkdirs()
167-
}
168-
169-
File f = new File(dir, notificationsCorePlugin)
170-
if (!f.exists()) {
171-
new URL(notificationsCoreRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }}
172-
}
173-
fileTree(notificationsCoreFilePath).getSingleFile()
165+
return configurations.zipArchive.asFileTree.matching {
166+
include '**/opensearch-notifications-core*'
167+
}.singleFile
174168
}
175169
}
176170
}))
@@ -179,17 +173,9 @@ testClusters.integTest {
179173
new RegularFile() {
180174
@Override
181175
File getAsFile() {
182-
File dir = new File(rootDir.path + "/alerting/" + notificationsFilePath)
183-
184-
if (!dir.exists()) {
185-
dir.mkdirs()
186-
}
187-
188-
File f = new File(dir, notificationsPlugin)
189-
if (!f.exists()) {
190-
new URL(notificationsRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }}
191-
}
192-
fileTree(notificationsFilePath).getSingleFile()
176+
return configurations.zipArchive.asFileTree.matching {
177+
include '**/notifications*'
178+
}.singleFile
193179
}
194180
}
195181
}))
@@ -343,35 +329,19 @@ task prepareBwcTests {
343329
new RegularFile() {
344330
@Override
345331
File getAsFile() {
346-
File dir = new File(rootDir.path + "/alerting/" + notificationsCoreFilePath)
347-
348-
if (!dir.exists()) {
349-
dir.mkdirs()
350-
}
351-
352-
File f = new File(dir, notificationsCorePlugin)
353-
if (!f.exists()) {
354-
new URL(notificationsCoreRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }}
355-
}
356-
fileTree(notificationsCoreFilePath).getSingleFile()
332+
return configurations.zipArchive.asFileTree.matching {
333+
include '**/opensearch-notifications-core*'
334+
}.singleFile
357335
}
358336
}
359337
}),
360338
provider({
361339
new RegularFile() {
362340
@Override
363341
File getAsFile() {
364-
File dir = new File(rootDir.path + "/alerting/" + notificationsFilePath)
365-
366-
if (!dir.exists()) {
367-
dir.mkdirs()
368-
}
369-
370-
File f = new File(dir, notificationsPlugin)
371-
if (!f.exists()) {
372-
new URL(notificationsRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }}
373-
}
374-
fileTree(notificationsFilePath).getSingleFile()
342+
return configurations.zipArchive.asFileTree.matching {
343+
include '**/notifications*'
344+
}.singleFile
375345
}
376346
}
377347
})

0 commit comments

Comments
 (0)