Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove zips and download from remote at build time #337

Merged
merged 3 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions reports-scheduler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ Zip bundle = (Zip) project.getTasks().getByName("bundlePlugin");
integTest.dependsOn(bundle)
integTest.getClusters().forEach{c -> c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile()))}

String jobSchedulerURL = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + opensearch_version.replace("-SNAPSHOT", "") + "/latest/linux/x64/builds/opensearch/plugins/opensearch-job-scheduler-" + opensearch_build.replace("-SNAPSHOT", "") + ".zip"

testClusters.integTest {
testDistribution = "INTEG_TEST"
// need to install job-scheduler first, need to assemble job-scheduler first
Expand All @@ -260,6 +262,14 @@ testClusters.integTest {
return new RegularFile() {
@Override
File getAsFile() {
File dir = new File("src/test/resources/job-scheduler")
if (!dir.exists()) {
dir.mkdirs()
}
File file = new File(dir, "opensearch-job-scheduler-" + opensearch_build + ".zip")
if (!file.exists()) {
new URL(jobSchedulerURL).withInputStream{ ins -> file.withOutputStream{ it << ins }}
}
return fileTree("src/test/resources/job-scheduler").getSingleFile()
}
}
Expand All @@ -285,6 +295,8 @@ testClusters.integTest {
String bwcVersion = "1.13.0.0"
String baseName = "reportsSchedulerBwcCluster"
String bwcFilePath = "src/test/resources/bwc"
String bwcJobSchedulerURL = "https://d3g5vo6xdbdb9a.cloudfront.net/downloads/elasticsearch-plugins/opendistro-job-scheduler/opendistro-job-scheduler-" + bwcVersion + ".zip"
String bwcReportsSchedulerURL = "https://d3g5vo6xdbdb9a.cloudfront.net/downloads/elasticsearch-plugins/opendistro-reports-scheduler/opendistro-reports-scheduler-" + bwcVersion + ".zip"

2.times {i ->
testClusters {
Expand All @@ -298,6 +310,14 @@ String bwcFilePath = "src/test/resources/bwc"
return new RegularFile() {
@Override
File getAsFile() {
File dir = new File(bwcFilePath + "/job-scheduler/" + bwcVersion)
if (!dir.exists()) {
dir.mkdirs()
}
File file = new File(dir, "opendistro-job-scheduler-" + bwcVersion + ".zip")
if (!file.exists()) {
new URL(bwcJobSchedulerURL).withInputStream{ ins -> file.withOutputStream{ it << ins }}
}
return fileTree(bwcFilePath + "/job-scheduler/" + bwcVersion).getSingleFile()
}
}
Expand All @@ -309,6 +329,14 @@ String bwcFilePath = "src/test/resources/bwc"
return new RegularFile() {
@Override
File getAsFile() {
File dir = new File(bwcFilePath + "/reports-scheduler/" + bwcVersion)
if (!dir.exists()) {
dir.mkdirs()
}
File file = new File(dir, "opendistro-reports-scheduler-" + bwcVersion + ".zip")
if (!file.exists()) {
new URL(bwcReportsSchedulerURL).withInputStream{ ins -> file.withOutputStream{ it << ins }}
}
return fileTree(bwcFilePath + "/reports-scheduler/" + bwcVersion).getSingleFile()
}
}
Expand All @@ -333,6 +361,14 @@ task prepareBwcTests {
return new RegularFile() {
@Override
File getAsFile() {
File dir = new File(bwcFilePath + "/job-scheduler/" + project.version)
if (!dir.exists()) {
dir.mkdirs()
}
File file = new File(dir, "opendistro-reports-scheduler-" + project.version + ".zip")
if (!file.exists()) {
new URL(jobSchedulerURL).withInputStream{ ins -> file.withOutputStream{ it << ins }}
}
return fileTree(bwcFilePath + "/job-scheduler/" + project.version).getSingleFile()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ internal fun createReportDefinitionDetails(): ReportDefinitionDetails {
listOf(),
reportDefinition = createReportDefinitionObject()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ internal class CreateReportDefinitionRequestTests {
val recreatedObject = createObjectFromJsonString(jsonString) { CreateReportDefinitionRequest(it) }
Assertions.assertEquals(reportDefinitionObject, recreatedObject.reportDefinition)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ internal class CreateReportDefinitionResponseTests {
val recreatedObject = createObjectFromJsonString(jsonString) { CreateReportDefinitionResponse.parse(it) }
Assertions.assertEquals(reportDefinitionId, recreatedObject.reportDefinitionId)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ internal class DeleteReportDefinitionRequestTests {
val recreatedObject = createObjectFromJsonString(jsonString) { DeleteReportDefinitionRequest.parse(it) }
assertEquals(reportDefinitionId, recreatedObject.reportDefinitionId)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ internal class DeleteReportDefinitionResponseTests {
val recreatedObject = createObjectFromJsonString(jsonString) { DeleteReportDefinitionResponse.parse(it) }
assertEquals(reportDefinitionId, recreatedObject.reportDefinitionId)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ internal class GetAllReportDefinitionsRequestTests {
assertEquals(0, recreatedObject.fromIndex)
assertEquals(defaultMaxItems, recreatedObject.maxItems)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@ internal class GetAllReportDefinitionsResponseTests {
val recreatedObject = createObjectFromJsonString(jsonString) { GetAllReportDefinitionsResponse(it) }
Assertions.assertEquals(reportDefinitionDetailsSearchResults.objectList, recreatedObject.reportDefinitionList.objectList)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ internal class GetAllReportInstancesRequestTests {
assertEquals(0, recreatedObject.fromIndex)
assertEquals(defaultMaxItems, recreatedObject.maxItems)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ internal class GetAllReportInstancesResponseTests {
val recreatedObject = createObjectFromJsonString(jsonString) { GetAllReportInstancesResponse(it) }
Assertions.assertEquals(reportInstanceSearchResults.objectList, recreatedObject.reportInstanceList.objectList)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ internal class GetReportDefinitionRequestTests {
val recreatedObject = createObjectFromJsonString(jsonString) { GetReportDefinitionRequest.parse(it) }
assertEquals(reportDefinitionId, recreatedObject.reportDefinitionId)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ internal class GetReportDefinitionResponseTests {
val recreatedObject = createObjectFromJsonString(jsonString) { GetReportDefinitionResponse(it) }
assertEquals(reportDefinitionDetails, recreatedObject.reportDefinitionDetails)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ internal class GetReportInstanceRequestTests {
val recreatedObject = createObjectFromJsonString(jsonString) { GetReportInstanceRequest.parse(it) }
Assertions.assertEquals(reportInstanceId, recreatedObject.reportInstanceId)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ internal class GetReportInstanceResponseTests {
val recreatedObject = createObjectFromJsonString(jsonString) { GetReportInstanceResponse(it) }
Assertions.assertEquals(reportInstance, recreatedObject.reportInstance)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ internal class InContextReportCreateRequestTests {
val recreatedObject = createObjectFromJsonString(jsonString) { InContextReportCreateRequest(it) }
verify(request, recreatedObject)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ internal class InContextReportCreateResponseTests {
val recreatedObject = createObjectFromJsonString(jsonString) { InContextReportCreateResponse(it) }
Assertions.assertEquals(reportInstance, recreatedObject.reportInstance)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ internal class OnDemandReportCreateRequestTests {
val recreatedObject = createObjectFromJsonString(jsonString) { OnDemandReportCreateRequest.parse(it) }
Assertions.assertEquals(reportDefinitionId, recreatedObject.reportDefinitionId)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ internal class OnDemandReportCreateResponseTests {
val recreatedObject = createObjectFromJsonString(jsonString) { OnDemandReportCreateResponse(it) }
Assertions.assertEquals(reportInstance, recreatedObject.reportInstance)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ internal class UpdateReportDefinitionRequestTests {
val recreatedObject = createObjectFromJsonString(jsonString) { UpdateReportDefinitionRequest(it) }
Assertions.assertEquals(reportDefinitionRequest.reportDefinition, recreatedObject.reportDefinition)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ internal class UpdateReportDefinitionResponseTests {
val recreatedObject = createObjectFromJsonString(jsonString) { UpdateReportDefinitionResponse.parse(it) }
Assertions.assertEquals(reportDefinitionId, recreatedObject.reportDefinitionId)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ internal class UpdateReportInstanceStatusRequestTests {
val recreatedObject = createObjectFromJsonString(jsonString) { UpdateReportInstanceStatusRequest.parse(it) }
verify(request, recreatedObject)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ internal class UpdateReportInstanceStatusResponseTests {
val recreatedObject = createObjectFromJsonString(jsonString) { UpdateReportInstanceStatusResponse.parse(it) }
Assertions.assertEquals(reportInstanceId, recreatedObject.reportInstanceId)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ignore artifacts in this directory
*
*/
!.gitignore
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ignore artifacts in this directory
*
*/
!.gitignore
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ignore artifacts in this directory
*
*/
!.gitignore
Binary file not shown.