Skip to content

Commit ac44f8b

Browse files
authored
Split bwc-tests to bwc-rolling-upgrade and bwc-full-restart (opensearch-project#4716) (opensearch-project#4718)
* Split bwc-tests to bwc-rolling-upgrade and bwc-full-restart (opensearch-project#4716) Signed-off-by: Lantao Jin <ltjin@amazon.com> (cherry picked from commit a9e5d39) * resolve conflicts Signed-off-by: Lantao Jin <ltjin@amazon.com> --------- Signed-off-by: Lantao Jin <ltjin@amazon.com>
1 parent 4ecc3cc commit ac44f8b

4 files changed

Lines changed: 216 additions & 108 deletions

File tree

.github/workflows/sql-test-and-build-workflow.yml

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ jobs:
182182
doctest/build/testclusters/docTestCluster-0/logs/*
183183
integ-test/build/testclusters/*/logs/*
184184
185-
bwc-tests:
185+
bwc-tests-rolling-upgrade:
186186
needs: Get-CI-Image-Tag
187187
runs-on: ubuntu-latest
188188
strategy:
@@ -204,10 +204,56 @@ jobs:
204204
distribution: 'temurin'
205205
java-version: ${{ matrix.java }}
206206

207-
- name: Run backward compatibility tests
207+
- name: Run backward compatibility tests in rolling upgrade
208208
run: |
209209
chown -R 1000:1000 `pwd`
210-
su `id -un 1000` -c "./scripts/bwctest.sh"
210+
su `id -un 1000` -c "./scripts/bwctest-rolling-upgrade.sh"
211+
212+
- name: Upload test reports
213+
if: ${{ always() }}
214+
uses: actions/upload-artifact@v4
215+
continue-on-error: true
216+
with:
217+
name: test-reports-ubuntu-latest-${{ matrix.java }}-bwc
218+
path: |
219+
sql/build/reports/**
220+
ppl/build/reports/**
221+
core/build/reports/**
222+
common/build/reports/**
223+
opensearch/build/reports/**
224+
integ-test/build/reports/**
225+
protocol/build/reports/**
226+
legacy/build/reports/**
227+
plugin/build/reports/**
228+
doctest/build/testclusters/docTestCluster-0/logs/*
229+
integ-test/build/testclusters/*/logs/*
230+
231+
bwc-tests-full-restart:
232+
needs: Get-CI-Image-Tag
233+
runs-on: ubuntu-latest
234+
strategy:
235+
matrix:
236+
java: [11, 17, 21]
237+
container:
238+
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
239+
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}
240+
241+
steps:
242+
- name: Run start commands
243+
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
244+
245+
- uses: actions/checkout@v4
246+
247+
- name: Set up JDK ${{ matrix.java }}
248+
uses: actions/setup-java@v4
249+
with:
250+
distribution: 'temurin'
251+
java-version: ${{ matrix.java }}
252+
253+
- name: Run backward compatibility tests in full restart
254+
run: |
255+
chown -R 1000:1000 `pwd`
256+
su `id -un 1000` -c "./scripts/bwctest-full-restart.sh"
211257
212258
- name: Upload test reports
213259
if: ${{ always() }}

integ-test/build.gradle

Lines changed: 108 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -582,83 +582,80 @@ String bwcRemoteFileRoot = "https://ci.opensearch.org/ci/dbc/bundle-build/1.1.0/
582582
String bwcRemoteFileSqlPlugin = bwcRemoteFileRoot + bwcSqlPlugin
583583
String bwcRemoteFileJSPlugin = bwcRemoteFileRoot + bwcJSPlugin
584584

585-
2.times { i ->
586-
testClusters {
587-
"${baseName}$i" {
588-
testDistribution = "ARCHIVE"
589-
numberOfNodes = 3
590-
if (bwcBundleTest) {
591-
versions = ["1.3.2", currentVersion]
592-
nodes.each { node ->
593-
node.extraConfigFile("kirk.pem", file("src/test/resources/security/kirk.pem"))
594-
node.extraConfigFile("kirk-key.pem", file("src/test/resources/security/kirk-key.pem"))
595-
node.extraConfigFile("esnode.pem", file("src/test/resources/security/esnode.pem"))
596-
node.extraConfigFile("esnode-key.pem", file("src/test/resources/security/esnode-key.pem"))
597-
node.extraConfigFile("root-ca.pem", file("src/test/resources/security/root-ca.pem"))
598-
node.setting("plugins.security.disabled", "true")
599-
node.setting("plugins.security.ssl.transport.pemcert_filepath", "esnode.pem")
600-
node.setting("plugins.security.ssl.transport.pemkey_filepath", "esnode-key.pem")
601-
node.setting("plugins.security.ssl.transport.pemtrustedcas_filepath", "root-ca.pem")
602-
node.setting("plugins.security.ssl.transport.enforce_hostname_verification", "false")
603-
node.setting("plugins.security.ssl.http.enabled", "true")
604-
node.setting("plugins.security.ssl.http.pemcert_filepath", "esnode.pem")
605-
node.setting("plugins.security.ssl.http.pemkey_filepath", "esnode-key.pem")
606-
node.setting("plugins.security.ssl.http.pemtrustedcas_filepath", "root-ca.pem")
607-
node.setting("plugins.security.allow_unsafe_democertificates", "true")
608-
node.setting("plugins.security.allow_default_init_securityindex", "true")
609-
node.setting("plugins.security.authcz.admin_dn", "CN=kirk,OU=client,O=client,L=test,C=de")
610-
node.setting("plugins.security.audit.type", "internal_elasticsearch")
611-
node.setting("plugins.security.enable_snapshot_restore_privilege", "true")
612-
node.setting("plugins.security.check_snapshot_restore_write_privileges", "true")
613-
node.setting("plugins.security.restapi.roles_enabled", "[\"all_access\", \"security_rest_api_access\"]")
614-
node.setting("plugins.security.system_indices.enabled", "true")
615-
}
616-
} else {
617-
versions = ["1.1.0", opensearch_version]
618-
plugin(provider(new Callable<RegularFile>(){
619-
@Override
620-
RegularFile call() throws Exception {
621-
return new RegularFile() {
622-
@Override
623-
File getAsFile() {
624-
if (new File("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion").exists()) {
625-
project.delete(files("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion"))
626-
}
627-
project.mkdir bwcJSPluginPath + bwcVersion
628-
ant.get(src: bwcRemoteFileJSPlugin,
629-
dest: bwcJSPluginPath + bwcVersion,
630-
httpusecaches: false)
631-
return fileTree(bwcJSPluginPath + bwcVersion).getSingleFile()
585+
testClusters {
586+
"${baseName}" {
587+
testDistribution = "ARCHIVE"
588+
numberOfNodes = 3
589+
if (bwcBundleTest) {
590+
versions = ["1.3.2", currentVersion]
591+
nodes.each { node ->
592+
node.extraConfigFile("kirk.pem", file("src/test/resources/security/kirk.pem"))
593+
node.extraConfigFile("kirk-key.pem", file("src/test/resources/security/kirk-key.pem"))
594+
node.extraConfigFile("esnode.pem", file("src/test/resources/security/esnode.pem"))
595+
node.extraConfigFile("esnode-key.pem", file("src/test/resources/security/esnode-key.pem"))
596+
node.extraConfigFile("root-ca.pem", file("src/test/resources/security/root-ca.pem"))
597+
node.setting("plugins.security.disabled", "true")
598+
node.setting("plugins.security.ssl.transport.pemcert_filepath", "esnode.pem")
599+
node.setting("plugins.security.ssl.transport.pemkey_filepath", "esnode-key.pem")
600+
node.setting("plugins.security.ssl.transport.pemtrustedcas_filepath", "root-ca.pem")
601+
node.setting("plugins.security.ssl.transport.enforce_hostname_verification", "false")
602+
node.setting("plugins.security.ssl.http.enabled", "true")
603+
node.setting("plugins.security.ssl.http.pemcert_filepath", "esnode.pem")
604+
node.setting("plugins.security.ssl.http.pemkey_filepath", "esnode-key.pem")
605+
node.setting("plugins.security.ssl.http.pemtrustedcas_filepath", "root-ca.pem")
606+
node.setting("plugins.security.allow_unsafe_democertificates", "true")
607+
node.setting("plugins.security.allow_default_init_securityindex", "true")
608+
node.setting("plugins.security.authcz.admin_dn", "CN=kirk,OU=client,O=client,L=test,C=de")
609+
node.setting("plugins.security.audit.type", "internal_elasticsearch")
610+
node.setting("plugins.security.enable_snapshot_restore_privilege", "true")
611+
node.setting("plugins.security.check_snapshot_restore_write_privileges", "true")
612+
node.setting("plugins.security.restapi.roles_enabled", "[\"all_access\", \"security_rest_api_access\"]")
613+
node.setting("plugins.security.system_indices.enabled", "true")
614+
}
615+
} else {
616+
versions = ["1.1.0", opensearch_version]
617+
plugin(provider(new Callable<RegularFile>(){
618+
@Override
619+
RegularFile call() throws Exception {
620+
return new RegularFile() {
621+
@Override
622+
File getAsFile() {
623+
if (new File("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion").exists()) {
624+
project.delete(files("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion"))
632625
}
626+
project.mkdir bwcJSPluginPath + bwcVersion
627+
ant.get(src: bwcRemoteFileJSPlugin,
628+
dest: bwcJSPluginPath + bwcVersion,
629+
httpusecaches: false)
630+
return fileTree(bwcJSPluginPath + bwcVersion).getSingleFile()
633631
}
634632
}
635-
}))
636-
plugin(provider(new Callable<RegularFile>() {
637-
@Override
638-
RegularFile call() throws Exception {
639-
return new RegularFile() {
640-
@Override
641-
File getAsFile() {
642-
File dir = new File('./integ-test/' + bwcFilePath + bwcVersion)
643-
if (!dir.exists()) {
644-
dir.mkdirs()
645-
}
646-
File f = new File(dir, bwcSqlPlugin)
647-
if (!f.exists()) {
648-
new URL(bwcRemoteFileSqlPlugin).withInputStream{ ins -> f.withOutputStream{ it << ins }}
649-
}
650-
return fileTree(bwcFilePath + bwcVersion).getSingleFile()
633+
}
634+
}))
635+
plugin(provider(new Callable<RegularFile>() {
636+
@Override
637+
RegularFile call() throws Exception {
638+
return new RegularFile() {
639+
@Override
640+
File getAsFile() {
641+
File dir = new File('./integ-test/' + bwcFilePath + bwcVersion)
642+
if (!dir.exists()) {
643+
dir.mkdirs()
651644
}
645+
File f = new File(dir, bwcSqlPlugin)
646+
if (!f.exists()) {
647+
new URL(bwcRemoteFileSqlPlugin).withInputStream{ ins -> f.withOutputStream{ it << ins }}
648+
}
649+
return fileTree(bwcFilePath + bwcVersion).getSingleFile()
652650
}
653651
}
654-
}))
655-
}
656-
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
657-
setting 'http.content_type.required', 'true'
652+
}
653+
}))
658654
}
655+
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
656+
setting 'http.content_type.required', 'true'
659657
}
660658
}
661-
662659
List<Provider<RegularFile>> plugins = [
663660
provider(new Callable<RegularFile>() {
664661
@Override
@@ -696,34 +693,32 @@ List<Provider<RegularFile>> plugins = [
696693
]
697694

698695

699-
// Creates 2 test clusters with 3 nodes of the old version.
700-
2.times { i ->
701-
task "${baseName}#oldVersionClusterTask$i"(type: StandaloneRestIntegTestTask) {
702-
useCluster testClusters."${baseName}$i"
703-
filter {
704-
includeTestsMatching "org.opensearch.sql.bwc.*IT"
705-
}
706-
systemProperty 'tests.rest.bwcsuite', 'old_cluster'
707-
systemProperty 'tests.rest.bwcsuite_round', 'old'
708-
systemProperty 'tests.plugin_bwc_version', bwcVersion
709-
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}$i".allHttpSocketURI.join(",")}")
710-
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}$i".getName()}")
696+
// Creates test cluster with 3 nodes of the old version.
697+
task "${baseName}#oldVersionClusterTask"(type: StandaloneRestIntegTestTask) {
698+
useCluster testClusters."${baseName}"
699+
filter {
700+
includeTestsMatching "org.opensearch.sql.bwc.*IT"
711701
}
702+
systemProperty 'tests.rest.bwcsuite', 'old_cluster'
703+
systemProperty 'tests.rest.bwcsuite_round', 'old'
704+
systemProperty 'tests.plugin_bwc_version', bwcVersion
705+
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
706+
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
712707
}
713708

714709
// Upgrade one node of the old cluster to new OpenSearch version with upgraded plugin version.
715710
// This results in a mixed cluster with 2 nodes on the old version and 1 upgraded node.
716711
// This is also used as a one third upgraded cluster for a rolling upgrade.
717712
task "${baseName}#mixedClusterTask"(type: StandaloneRestIntegTestTask) {
718-
useCluster testClusters."${baseName}0"
719-
dependsOn "${baseName}#oldVersionClusterTask0"
713+
useCluster testClusters."${baseName}"
714+
dependsOn "${baseName}#oldVersionClusterTask"
720715
if (bwcBundleTest){
721716
doFirst {
722-
testClusters."${baseName}0".nextNodeToNextVersion()
717+
testClusters."${baseName}".nextNodeToNextVersion()
723718
}
724719
} else {
725720
doFirst {
726-
testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins)
721+
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion(plugins)
727722
}
728723
}
729724
filter {
@@ -732,23 +727,23 @@ task "${baseName}#mixedClusterTask"(type: StandaloneRestIntegTestTask) {
732727
systemProperty 'tests.rest.bwcsuite', 'mixed_cluster'
733728
systemProperty 'tests.rest.bwcsuite_round', 'first'
734729
systemProperty 'tests.plugin_bwc_version', bwcVersion
735-
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}0".allHttpSocketURI.join(",")}")
736-
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}0".getName()}")
730+
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
731+
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
737732
}
738733

739734
// Upgrade the second node to new OpenSearch version with upgraded plugin version after the first node is upgraded.
740735
// This results in a mixed cluster with 1 node on the old version and 2 upgraded nodes.
741736
// This is used for rolling upgrade.
742737
task "${baseName}#twoThirdsUpgradedClusterTask"(type: StandaloneRestIntegTestTask) {
743738
dependsOn "${baseName}#mixedClusterTask"
744-
useCluster testClusters."${baseName}0"
739+
useCluster testClusters."${baseName}"
745740
if (bwcBundleTest){
746741
doFirst {
747-
testClusters."${baseName}0".nextNodeToNextVersion()
742+
testClusters."${baseName}".nextNodeToNextVersion()
748743
}
749744
} else {
750745
doFirst {
751-
testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins)
746+
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion(plugins)
752747
}
753748
}
754749
filter {
@@ -757,23 +752,23 @@ task "${baseName}#twoThirdsUpgradedClusterTask"(type: StandaloneRestIntegTestTas
757752
systemProperty 'tests.rest.bwcsuite', 'mixed_cluster'
758753
systemProperty 'tests.rest.bwcsuite_round', 'second'
759754
systemProperty 'tests.plugin_bwc_version', bwcVersion
760-
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}0".allHttpSocketURI.join(",")}")
761-
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}0".getName()}")
755+
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
756+
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
762757
}
763758

764759
// Upgrade the third node to new OpenSearch version with upgraded plugin version after the second node is upgraded.
765760
// This results in a fully upgraded cluster.
766761
// This is used for rolling upgrade.
767762
task "${baseName}#rollingUpgradeClusterTask"(type: StandaloneRestIntegTestTask) {
768763
dependsOn "${baseName}#twoThirdsUpgradedClusterTask"
769-
useCluster testClusters."${baseName}0"
764+
useCluster testClusters."${baseName}"
770765
if (bwcBundleTest){
771766
doFirst {
772-
testClusters."${baseName}0".nextNodeToNextVersion()
767+
testClusters."${baseName}".nextNodeToNextVersion()
773768
}
774769
} else {
775770
doFirst {
776-
testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins)
771+
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion(plugins)
777772
}
778773
}
779774
filter {
@@ -783,42 +778,51 @@ task "${baseName}#rollingUpgradeClusterTask"(type: StandaloneRestIntegTestTask)
783778
systemProperty 'tests.rest.bwcsuite', 'mixed_cluster'
784779
systemProperty 'tests.rest.bwcsuite_round', 'third'
785780
systemProperty 'tests.plugin_bwc_version', bwcVersion
786-
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}0".allHttpSocketURI.join(",")}")
787-
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}0".getName()}")
781+
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
782+
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
788783
}
789784

790785
// Upgrade all the nodes of the old cluster to new OpenSearch version with upgraded plugin version
791786
// at the same time resulting in a fully upgraded cluster.
792787
task "${baseName}#fullRestartClusterTask"(type: StandaloneRestIntegTestTask) {
793-
dependsOn "${baseName}#oldVersionClusterTask1"
794-
useCluster testClusters."${baseName}1"
788+
dependsOn "${baseName}#oldVersionClusterTask"
789+
useCluster testClusters."${baseName}"
795790
if (bwcBundleTest){
796791
doFirst {
797-
testClusters."${baseName}1".goToNextVersion()
792+
testClusters."${baseName}".goToNextVersion()
798793
}
799794
} else {
800795
doFirst {
801-
testClusters."${baseName}1".upgradeAllNodesAndPluginsToNextVersion(plugins)
796+
testClusters."${baseName}".upgradeAllNodesAndPluginsToNextVersion(plugins)
802797
}
803798
}
804799
filter {
805800
includeTestsMatching "org.opensearch.sql.bwc.*IT"
806801
}
807802
systemProperty 'tests.rest.bwcsuite', 'upgraded_cluster'
808803
systemProperty 'tests.plugin_bwc_version', bwcVersion
809-
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}1".allHttpSocketURI.join(",")}")
810-
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}1".getName()}")
804+
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
805+
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
811806
}
812807

813-
// A bwc test suite which runs all the bwc tasks combined
814-
task bwcTestSuite(type: StandaloneRestIntegTestTask) {
808+
// A bwc test suite which runs all the bwc tasks in rolling upgrade
809+
task bwcTestRollingUpgradeSuite(type: StandaloneRestIntegTestTask) {
815810
testLogging {
816811
events "passed", "skipped", "failed"
817812
}
818813
exclude '**/*Test*'
819814
exclude '**/*IT*'
820815
dependsOn tasks.named("${baseName}#mixedClusterTask")
821816
dependsOn tasks.named("${baseName}#rollingUpgradeClusterTask")
817+
}
818+
819+
// A bwc test suite which runs all the bwc tasks in full restart
820+
task bwcTestFullRestartSuite(type: StandaloneRestIntegTestTask) {
821+
testLogging {
822+
events "passed", "skipped", "failed"
823+
}
824+
exclude '**/*Test*'
825+
exclude '**/*IT*'
822826
dependsOn tasks.named("${baseName}#fullRestartClusterTask")
823827
}
824828

0 commit comments

Comments
 (0)