forked from opensearch-project/neural-search
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
184 lines (167 loc) · 8.88 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask
apply from : "$rootDir/qa/build.gradle"
def ext=rootProject.ext
String baseName = "neuralSearchBwcCluster-rolling"
// Creates a test cluster of previous version and loads k-NN plugin of bwcVersion
testClusters {
"${baseName}" {
testDistribution = "ARCHIVE"
jvmArgs("-Xms1g", "-Xmx4g")
numberOfNodes = 3
if(ext.bwcBundleTest){
versions = [ext.neural_search_bwc_version, ext.currentBundleVersion]
def path=ext.opensearch_tmp_dir
nodes.each { node ->
node.extraConfigFile("kirk.pem", file("$path/kirk.pem"))
node.extraConfigFile("kirk-key.pem", file("$path/kirk-key.pem"))
node.extraConfigFile("esnode.pem", file("$path/esnode.pem"))
node.extraConfigFile("esnode-key.pem", file("$path/esnode-key.pem"))
node.extraConfigFile("root-ca.pem", file("$path/root-ca.pem"))
node.setting("plugins.security.disabled", "true")
node.setting("plugins.security.ssl.transport.pemcert_filepath", "esnode.pem")
node.setting("plugins.security.ssl.transport.pemkey_filepath", "esnode-key.pem")
node.setting("plugins.security.ssl.transport.pemtrustedcas_filepath", "root-ca.pem")
node.setting("plugins.security.ssl.transport.enforce_hostname_verification", "false")
node.setting("plugins.security.ssl.http.enabled", "true")
node.setting("plugins.security.ssl.http.pemcert_filepath", "esnode.pem")
node.setting("plugins.security.ssl.http.pemkey_filepath", "esnode-key.pem")
node.setting("plugins.security.ssl.http.pemtrustedcas_filepath", "root-ca.pem")
node.setting("plugins.security.allow_unsafe_democertificates", "true")
node.setting("plugins.security.allow_default_init_securityindex", "true")
node.setting("plugins.security.authcz.admin_dn", "CN=kirk,OU=client,O=client,L=test,C=de")
node.setting("plugins.security.audit.type", "internal_elasticsearch")
node.setting("plugins.security.enable_snapshot_restore_privilege", "true")
node.setting("plugins.security.check_snapshot_restore_write_privileges", "true")
node.setting("plugins.security.restapi.roles_enabled", "[\"all_access\", \"security_rest_api_access\"]")
node.setting("plugins.security.system_indices.enabled", "true")
}
}else{
versions = [ext.neural_search_bwc_version, opensearch_version]
plugin(project.tasks.zipBwcJobSchedulerPlugin.archiveFile)
plugin(project.tasks.zipBwcMlCommonsPlugin.archiveFile)
plugin(project.tasks.zipBwcKnnPlugin.archiveFile)
plugin(project.tasks.zipBwcPlugin.archiveFile)
}
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
setting 'http.content_type.required', 'true'
}
}
def versionsBelow2_11 = ["2.9", "2.10"]
def versionsBelow2_12 = versionsBelow2_11 + "2.11"
def versionsBelow2_13 = versionsBelow2_12 + "2.12"
def versionsBelow2_14 = versionsBelow2_13 + "2.13"
def versionsBelow2_15 = versionsBelow2_14 + "2.14"
def versionsBelow2_16 = versionsBelow2_15 + "2.15"
def versionsBelow2_17 = versionsBelow2_16 + "2.16"
def versionsBelow2_18 = versionsBelow2_17 + "2.17"
def versionsBelow2_19 = versionsBelow2_18 + "2.18"
def versionsBelow2_20 = versionsBelow2_19 + "2.19"
def versionsBelow3_0 = versionsBelow2_20 + "2.20"
// Task to run BWC tests against the old cluster
task testAgainstOldCluster(type: StandaloneRestIntegTestTask) {
if(!ext.bwcBundleTest){
dependsOn "zipBwcPlugin"
}
useCluster testClusters."${baseName}"
systemProperty 'tests.rest.bwcsuite_cluster', 'old_cluster'
systemProperty 'tests.plugin_bwc_version', ext.neural_search_bwc_version
systemProperty 'tests.skip_delete_model_index', 'true'
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
systemProperty 'tests.security.manager', 'false'
// Excluding stats tests because we introduce this feature in 3.0
if (versionsBelow3_0.any { ext.neural_search_bwc_version.startsWith(it) }){
filter {
excludeTestsMatching "org.opensearch.neuralsearch.bwc.rolling.RestNeuralStatsActionIT.*"
}
}
}
// Part of rolling upgrade. Upgrades one node of the old cluster to new OpenSearch version with upgraded plugin version
// This results in a mixed cluster with 2 nodes on the old version and 1 upgraded node.
task testAgainstOneThirdUpgradedCluster(type: StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
dependsOn rootProject.tasks.assemble
dependsOn "testAgainstOldCluster"
if (ext.bwcBundleTest){
doFirst {
testClusters."${baseName}".nextNodeToNextVersion()
}
}else{
doFirst {
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion(project.ext.plugins)
}
}
systemProperty 'tests.rest.bwcsuite_cluster', 'mixed_cluster'
systemProperty 'tests.rest.first_round', 'true'
systemProperty 'tests.skip_delete_model_index', 'true'
systemProperty 'tests.plugin_bwc_version', ext.neural_search_bwc_version
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
systemProperty 'tests.security.manager', 'false'
// Excluding stats tests because we introduce this feature in 3.0
if (versionsBelow3_0.any { ext.neural_search_bwc_version.startsWith(it) }){
filter {
excludeTestsMatching "org.opensearch.neuralsearch.bwc.rolling.RestNeuralStatsActionIT.*"
}
}
}
// Part of rolling upgrade. Upgrades the second node to new OpenSearch version with upgraded plugin version after the
// first node is upgraded. This results in a mixed cluster with 1 node on the old version and 2 upgraded nodes.
task testAgainstTwoThirdsUpgradedCluster(type: StandaloneRestIntegTestTask) {
dependsOn "testAgainstOneThirdUpgradedCluster"
useCluster testClusters."${baseName}"
if (ext.bwcBundleTest){
doFirst {
testClusters."${baseName}".nextNodeToNextVersion()
}
}else{
doFirst {
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion(project.ext.plugins)
}
}
systemProperty 'tests.rest.bwcsuite_cluster', 'mixed_cluster'
systemProperty 'tests.rest.first_round', 'false'
systemProperty 'tests.skip_delete_model_index', 'true'
systemProperty 'tests.plugin_bwc_version', ext.neural_search_bwc_version
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
systemProperty 'tests.security.manager', 'false'
// Excluding stats tests because we introduce this feature in 3.0
if (versionsBelow3_0.any { ext.neural_search_bwc_version.startsWith(it) }){
filter {
excludeTestsMatching "org.opensearch.neuralsearch.bwc.rolling.RestNeuralStatsActionIT.*"
}
}
}
// Part of rolling upgrade. Upgrades the third node to new OpenSearch version with upgraded plugin version after the
// second node is upgraded. This results in a fully upgraded cluster.
task testRollingUpgrade(type: StandaloneRestIntegTestTask) {
dependsOn "testAgainstTwoThirdsUpgradedCluster"
useCluster testClusters."${baseName}"
if (ext.bwcBundleTest){
doFirst {
testClusters."${baseName}".nextNodeToNextVersion()
}
}else{
doFirst {
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion(project.ext.plugins)
}
}
mustRunAfter "testAgainstOneThirdUpgradedCluster"
systemProperty 'tests.rest.bwcsuite_cluster', 'upgraded_cluster'
systemProperty 'tests.skip_delete_model_index', 'true'
systemProperty 'tests.plugin_bwc_version', ext.neural_search_bwc_version
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
systemProperty 'tests.security.manager', 'false'
// Excluding stats tests because we introduce this feature in 3.0
if (versionsBelow3_0.any { ext.neural_search_bwc_version.startsWith(it) }){
filter {
excludeTestsMatching "org.opensearch.neuralsearch.bwc.rolling.RestNeuralStatsActionIT.*"
}
}
}