Skip to content

Commit

Permalink
upgrade mockito and byte-buddy version to align with opensearch core …
Browse files Browse the repository at this point in the history
…and Fix BWC test case failure (#644)

* upgrade mockito and byte-buddy version to align with opensearch core

Signed-off-by: Hailong Cui <[email protected]>

* upgrade BWC version to 2.7.0 to fix BWC testcase

Signed-off-by: Hailong Cui <[email protected]>

* Enable logs for security run with docker

Signed-off-by: Hailong Cui <[email protected]>

* Remove unused lines

Signed-off-by: Hailong Cui <[email protected]>

---------

Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am authored Mar 30, 2023
1 parent 872264f commit 464fdb2
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/security-notifications-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ jobs:
if: env.imagePresent == 'true'
run: |
cd ..
docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" opensearch-notifications:test
container_id=`docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" opensearch-notifications:test`
sleep 120
echo `docker logs $container_id`
- name: Run Notification Test for security enabled test cases
if: env.imagePresent == 'true'
run: |
Expand Down
2 changes: 1 addition & 1 deletion notifications/core-spi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.6.2')
testImplementation "org.jetbrains.kotlin:kotlin-test:${kotlin_version}"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}" // required by mockk
testImplementation "net.bytebuddy:byte-buddy-agent:1.12.7"
testImplementation "net.bytebuddy:byte-buddy-agent:${versions.bytebuddy}"
testImplementation "org.opensearch.test:framework:${opensearch_version}"
}

Expand Down
2 changes: 1 addition & 1 deletion notifications/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ dependencies {
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.6.2')
testImplementation "org.jetbrains.kotlin:kotlin-test:${kotlin_version}"
testImplementation "net.bytebuddy:byte-buddy-agent:1.12.7"
testImplementation "org.mockito:mockito-core:5.1.0"
testImplementation "org.mockito:mockito-core:${versions.mockito}"
testImplementation "org.opensearch.test:framework:${opensearch_version}"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}" // required by mockk
implementation project(path: ":${rootProject.name}-core-spi", configuration: 'shadow')
Expand Down
88 changes: 39 additions & 49 deletions notifications/notifications/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ dependencies {
testImplementation "org.opensearch.test:framework:${opensearch_version}"
testImplementation "org.jetbrains.kotlin:kotlin-test:${kotlin_version}"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}" // required by mockk
testImplementation "net.bytebuddy:byte-buddy-agent:1.12.7"
testImplementation "org.mockito:mockito-core:5.1.0"
testImplementation "net.bytebuddy:byte-buddy-agent:${versions.bytebuddy}"
testImplementation "org.mockito:mockito-core:${versions.mockito}"
testImplementation 'com.google.code.gson:gson:2.8.9'
testImplementation 'org.springframework.integration:spring-integration-mail:5.5.0'
testImplementation 'org.springframework.integration:spring-integration-test-support:5.5.0'
Expand Down Expand Up @@ -259,61 +259,51 @@ testClusters.integTest {
setting 'path.repo', repo.absolutePath
}

String bwcVersion = "2.5.0.0"
// Always be minimumCompatibilityVersion of current opensearch version(3.0.0)
def bwcVersionShort = "2.7.0"
def bwcVersion = bwcVersionShort + ".0"
def bwcOpenSearchVesion= bwcVersionShort + "-SNAPSHOT"
def bwcPluginVersion = bwcVersion + "-SNAPSHOT"
String baseName = "notificationsBwcCluster"

String bwcPluginsResourcePath = "src/test/resources/plugins/bwc"
String bwcNotificationsCoreFilePath = "$bwcPluginsResourcePath/notifications-core/$bwcVersion"
String bwcNotificationsFilePath = "$bwcPluginsResourcePath/notifications/$bwcVersion"
String bwcNotificationsCoreDownload = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" +
"2.5.0/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-notifications-core-" +
bwcVersion + ".zip"
String bwcNotificationsDownload = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" +
"2.5.0/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-notifications-" +
bwcVersion + ".zip"
configurations {
opensearchPlugin
}

dependencies {
opensearchPlugin "org.opensearch.plugin:opensearch-notifications-core:${bwcPluginVersion}@zip"
opensearchPlugin "org.opensearch.plugin:notifications:${bwcPluginVersion}@zip"
}

ext.resolvePluginFile = { pluginId ->
return new Callable<RegularFile>() {
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
return configurations.opensearchPlugin.resolvedConfiguration.resolvedArtifacts
.find { ResolvedArtifact f ->
f.name.startsWith(pluginId)
}
.file
}
}
}
}
}

def notificationsCoreFile = resolvePluginFile("opensearch-notifications-core")
def notificationsFile = resolvePluginFile("notifications")

2.times { i ->
testClusters {
"${baseName}$i" {
testDistribution = "INTEG_TEST"
versions = ["2.5.0-SNAPSHOT", opensearch_version]
versions = [bwcOpenSearchVesion, opensearch_version]
numberOfNodes = 3
plugin(provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
if (new File("$project.rootDir/$bwcNotificationsCoreFilePath").exists()) {
project.delete(files("$project.rootDir/$bwcNotificationsCoreFilePath"))
}
project.mkdir bwcNotificationsCoreFilePath
ant.get(src: bwcNotificationsCoreDownload,
dest: bwcNotificationsCoreFilePath,
httpusecaches: false)
return fileTree(bwcNotificationsCoreFilePath).getSingleFile()
}
}
}
}))
plugin(provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
if (new File("$project.rootDir/$bwcNotificationsFilePath").exists()) {
project.delete(files("$project.rootDir/$bwcNotificationsFilePath"))
}
project.mkdir bwcNotificationsFilePath
ant.get(src: bwcNotificationsDownload,
dest: bwcNotificationsFilePath,
httpusecaches: false)
return fileTree(bwcNotificationsFilePath).getSingleFile()
}
}
}
}))
plugin(provider(notificationsCoreFile))
plugin(provider(notificationsFile))
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
setting 'http.content_type.required', 'true'
}
Expand Down

0 comments on commit 464fdb2

Please sign in to comment.