Skip to content

Commit

Permalink
Initial commit of BWC Test
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Jain <[email protected]>
  • Loading branch information
vibrantvarun committed Dec 7, 2023
1 parent b5a0fe4 commit 724bd36
Show file tree
Hide file tree
Showing 12 changed files with 684 additions and 0 deletions.
147 changes: 147 additions & 0 deletions .github/workflows/backwards_compatibility_tests_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Backwards Compatibility Tests NeuralSearch
on:
push:
branches:
- "*"
- "feature/**"
pull_request:
branches:
- "*"
- "feature/**"

jobs:
Restart-Upgrade-BWCTests-NeuralSearch:
strategy:
matrix:
java: [ 11, 17 ]
os: [ubuntu-latest]
bwc_version : [ "2.0.1", "2.1.0", "2.2.1", "2.3.0", "2.4.1", "2.5.0", "2.6.0", "2.7.0", "2.8.0", "2.9.0", "2.10.0", "2.11.0-SNAPSHOT"]
opensearch_version : [ "3.0.0-SNAPSHOT" ]
exclude:
- os: windows-latest
bwc_version: "2.0.1"
- os: windows-latest
bwc_version: "2.1.0"
- os: windows-latest
bwc_version: "2.2.1"
- os: windows-latest
bwc_version: "2.3.0"

name: NeuralSearch Restart-Upgrade BWC Tests
runs-on: ${{ matrix.os }}
env:
BWC_VERSION_RESTART_UPGRADE: ${{ matrix.bwc_version }}

steps:
- name: Checkout NeuralSearch
uses: actions/checkout@v1

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}

- if: startsWith(matrix.os,'ubuntu')
name: Install dependencies on ubuntu
run: |
sudo apt-get install libopenblas-dev gfortran -y
- if: startsWith(matrix.os,'windows')
name: Install MinGW Using Scoop on Windows
run: |
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
scoop bucket add main
scoop install mingw
- if: startsWith(matrix.os,'windows')
name: Add MinGW to PATH on Windows
run: |
echo "C:/Users/runneradmin/scoop/apps/mingw/current/bin" >> $env:GITHUB_PATH
refreshenv
- if: startsWith(matrix.os,'windows')
name: Download OpenBLAS on Windows
run: |
curl -L -O https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
mkdir OpenBLAS
Expand-Archive -Path .\OpenBLAS-0.3.21-x64.zip -DestinationPath .\OpenBLAS\
mkdir ./src/main/resources/windowsDependencies
cp ./OpenBLAS/bin/libopenblas.dll ./src/main/resources/windowsDependencies/
rm .\OpenBLAS-0.3.21-x64.zip
rm -r .\OpenBLAS\
- if: startsWith(matrix.os,'windows')
name: Run NeuralSearch Restart-Upgrade BWC Tests from BWCVersion-${{ matrix.bwc_version }} to OpenSearch Version-${{ matrix.opensearch_version }} on Windows
run: |
echo "Running restart-upgrade backwards compatibility tests ..."
./gradlew :qa:restart-upgrade:testRestartUpgrade -D'tests.bwc.version=${{ matrix.bwc_version }}'
- if: startsWith(matrix.os,'ubuntu')
name: Run NeuralSearch Restart-Upgrade BWC Tests from BWCVersion-${{ matrix.bwc_version }} to OpenSearch Version-${{ matrix.opensearch_version }} on Ubuntu
run: |
echo "Running restart-upgrade backwards compatibility tests ..."
./gradlew :qa:restart-upgrade:testRestartUpgrade -Dtests.bwc.version=$BWC_VERSION_RESTART_UPGRADE
Rolling-Upgrade-BWCTests-NeuralSearch:
strategy:
matrix:
java: [ 11, 17 ]
os: [ubuntu-latest]
bwc_version: [ "2.11.0-SNAPSHOT" ]
opensearch_version: [ "3.0.0-SNAPSHOT" ]

name: NeuralSearch Rolling-Upgrade BWC Tests
runs-on: ${{ matrix.os }}
env:
BWC_VERSION_ROLLING_UPGRADE: ${{ matrix.bwc_version }}

steps:
- name: Checkout NeuralSearch
uses: actions/checkout@v1

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}

- if: startsWith(matrix.os,'ubuntu')
name: Install dependencies on ubuntu
run: |
sudo apt-get install libopenblas-dev gfortran -y
- if: startsWith(matrix.os,'windows')
name: Install MinGW Using Scoop on Windows
run: |
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
scoop bucket add main
scoop install mingw
- if: startsWith(matrix.os,'windows')
name: Add MinGW to PATH on Windows
run: |
echo "C:/Users/runneradmin/scoop/apps/mingw/current/bin" >> $env:GITHUB_PATH
refreshenv
- if: startsWith(matrix.os,'windows')
name: Download OpenBLAS on Windows
run: |
curl -L -O https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
mkdir OpenBLAS
Expand-Archive -Path .\OpenBLAS-0.3.21-x64.zip -DestinationPath .\OpenBLAS\
mkdir ./src/main/resources/windowsDependencies
cp ./OpenBLAS/bin/libopenblas.dll ./src/main/resources/windowsDependencies/
rm .\OpenBLAS-0.3.21-x64.zip
rm -r .\OpenBLAS\
- if: startsWith(matrix.os,'windows')
name: Run NeuralSearch Rolling-Upgrade BWC Tests from BWCVersion-${{ matrix.bwc_version }} to OpenSearch Version-${{ matrix.opensearch_version }} on Windows
run: |
echo "Running rolling-upgrade backwards compatibility tests ..."
./gradlew :qa:rolling-upgrade:testRollingUpgrade -D'tests.bwc.version=${{ matrix.bwc_version }}'
- if: startsWith(matrix.os,'ubuntu')
name: Run NeuralSearch Rolling-Upgrade BWC Tests from BWCVersion-${{ matrix.bwc_version }} to OpenSearch Version-${{ matrix.opensearch_version }} on Ubuntu
run: |
echo "Running rolling-upgrade backwards compatibility tests ..."
./gradlew :qa:rolling-upgrade:testRollingUpgrade -Dtests.bwc.version=$BWC_VERSION_ROLLING_UPGRADE
20 changes: 20 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,26 @@ allprojects {
version = "${opensearch_build}"
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11

apply from: rootProject.file('repositories.gradle').absoluteFile
plugins.withId('java') {
sourceCompatibility = targetCompatibility = "11"
}

afterEvaluate {
project.dependencyLicenses.enabled = false
project.thirdPartyAudit.enabled = false
project.loggerUsageCheck.enabled = false
project.forbiddenApis.ignoreFailures = true
project.forbiddenPatterns {
setEnabled(false)
}
project.testingConventions.enabled = false
project.validateNebulaPom.enabled = false
project.licenseFile = rootProject.file('LICENSE.txt')
project.noticeFile = rootProject.file('NOTICE.txt')
project.forbiddenApis.ignoreFailures = true
}
}

repositories {
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# SPDX-License-Identifier: Apache-2.0
#

version=2.0.0
systemProp.bwc.version=2.10.0

# For fixing Spotless check with Java 17
org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
Expand Down
114 changes: 114 additions & 0 deletions qa/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import org.apache.tools.ant.taskdefs.condition.Os
import java.nio.file.Files

apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.build'
apply plugin: 'opensearch.rest-test'
apply plugin: 'io.freefair.lombok'

// Disable a few tasks that come with build
build.enabled = false
integTest.enabled = false
test.enabled = false
assemble.enabled = false
dependenciesInfo.enabled = false

repositories {
mavenLocal()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}

dependencies {
api "org.opensearch:opensearch:${opensearch_version}"
api group: 'commons-lang', name: 'commons-lang', version: '2.6'
api "org.apache.logging.log4j:log4j-api:${versions.log4j}"
api "org.apache.logging.log4j:log4j-core:${versions.log4j}"
api "junit:junit:${versions.junit}"
testImplementation "org.opensearch.test:framework:${opensearch_version}"
testImplementation(testFixtures(rootProject))
}

ext {
licenseFile = rootProject.file('LICENSE.txt')
noticeFile = rootProject.file('NOTICE.txt')
}

def tmp_dir = project.file('build/private/artifact_tmp').absoluteFile
tmp_dir.mkdirs()
String default_bwc_version = System.getProperty("bwc.version")
String neural_search_bwc_version = System.getProperty("tests.bwc.version", default_bwc_version)
boolean isSnapshot = neural_search_bwc_version.contains("-SNAPSHOT")
String neural_search_bwc_version_no_qualifier = isSnapshot ? neural_search_bwc_version - "-SNAPSHOT" : neural_search_bwc_version

String os_platform = "linux"
String artifact_type = "tar"
String file_ext = "tar.gz"

if (Os.isFamily(Os.FAMILY_WINDOWS)) {
os_platform = "windows"
artifact_type = "zip"
file_ext = "zip"
}

// Task to pull neural search plugin from archive
task pullBwcPlugin {
doFirst {
File[] tempFiles = tmp_dir.listFiles()
for (File child : tempFiles) {
if (child.exists() && child.toString().contains("opensearch-")) {
Files.delete(child.toPath());
}
}
}

doLast {
ext{
if (isSnapshot) {
srcUrl = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${neural_search_bwc_version_no_qualifier}/latest/${os_platform}/x64/${artifact_type}/dist/opensearch/opensearch-${neural_search_bwc_version_no_qualifier}-${os_platform}-x64.${file_ext}"
} else {
srcUrl = "https://artifacts.opensearch.org/releases/bundle/opensearch/${neural_search_bwc_version}/opensearch-${neural_search_bwc_version}-${os_platform}-x64.${file_ext}"
}
}
ant.get(
src: srcUrl,
dest: tmp_dir.absolutePath,
httpusecaches: false
)
copy {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
from zipTree(java.nio.file.Path.of(tmp_dir.absolutePath, "opensearch-${neural_search_bwc_version_no_qualifier}-${os_platform}-x64.${file_ext}"))
} else {
from tarTree(java.nio.file.Path.of(tmp_dir.absolutePath, "opensearch-${neural_search_bwc_version_no_qualifier}-${os_platform}-x64.${file_ext}"))
}
into tmp_dir.absolutePath
}
copy {
from(java.nio.file.Path.of(tmp_dir.absolutePath, "opensearch-neural-search-${neural_search_bwc_version_no_qualifier}", "plugins", "opensearch-neural-search"))
into java.nio.file.Path.of(tmp_dir.absolutePath, "opensearch-neural-search")
}
delete java.nio.file.Path.of(tmp_dir.absolutePath, "opensearch-${neural_search_bwc_version_no_qualifier}"), java.nio.file.Path.of(tmp_dir.absolutePath, "opensearch-${neural_search_bwc_version_no_qualifier}-${os_platform}-x64.${file_ext}")
}
}

// Task to zip plugin from archive
task zipBwcPlugin(type: Zip) {
dependsOn "pullBwcPlugin"
from(java.nio.file.Path.of(tmp_dir.absolutePath, "opensearch-neural-search"))
destinationDirectory = tmp_dir
archiveFileName = "opensearch-neural-search-${neural_search_bwc_version_no_qualifier}.zip"
doLast {
delete java.nio.file.Path.of(tmp_dir.absolutePath, "opensearch-neural-search")
}
}

task bwcTestSuite {
dependsOn ":qa:restart-upgrade:testRestartUpgrade"
dependsOn ":qa:rolling-upgrade:testRollingUpgrade"
}
Loading

0 comments on commit 724bd36

Please sign in to comment.