Skip to content

Commit fea6b4a

Browse files
authored
Refactored backwards compatibility tests to point to the OpenSearch 1.1.0.0 zip following deprecation of ODFE. (opensearch-project#510)
Signed-off-by: AWSHurneyt <[email protected]>
1 parent 3b8bfe7 commit fea6b4a

File tree

2 files changed

+32
-38
lines changed

2 files changed

+32
-38
lines changed

alerting/build.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ testClusters.integTest {
183183
}
184184

185185
testClusters.integTest.nodes.each { node ->
186-
node.setting("opendistro.destination.host.deny_list", "[\"10.0.0.0/8\", \"127.0.0.1\"]")
186+
node.setting("plugins.destination.host.deny_list", "[\"10.0.0.0/8\", \"127.0.0.1\"]")
187187
}
188188

189189
integTest {
@@ -247,17 +247,17 @@ task integTestRemote(type: RestIntegTestTask) {
247247
}
248248
integTestRemote.enabled = System.getProperty("tests.rest.cluster") != null
249249

250-
String bwcVersion = "1.13.1.0"
250+
String bwcVersion = "1.1.0.0"
251251
String baseName = "alertingBwcCluster"
252252
String bwcFilePath = "src/test/resources/bwc"
253-
String bwcOpenDistroPlugin = "opendistro-alerting-" + bwcVersion + ".zip"
254-
String bwcRemoteFile = 'https://d3g5vo6xdbdb9a.cloudfront.net/downloads/elasticsearch-plugins/opendistro-alerting/' + bwcOpenDistroPlugin
253+
String bwcOpenSearchPlugin = "opensearch-alerting-" + bwcVersion + ".zip"
254+
String bwcRemoteFile = 'https://ci.opensearch.org/ci/dbc/bundle-build/1.1.0/20210930/linux/x64/builds/opensearch/plugins/' + bwcOpenSearchPlugin
255255

256256
2.times {i ->
257257
testClusters {
258258
"${baseName}$i" {
259259
testDistribution = "ARCHIVE"
260-
versions = ["7.10.2","2.1.0-SNAPSHOT"]
260+
versions = ["1.1.0", "2.1.0-SNAPSHOT"]
261261
numberOfNodes = 3
262262
plugin(provider(new Callable<RegularFile>(){
263263
@Override
@@ -270,7 +270,7 @@ String bwcRemoteFile = 'https://d3g5vo6xdbdb9a.cloudfront.net/downloads/elastics
270270
if (!dir.exists()) {
271271
dir.mkdirs()
272272
}
273-
File f = new File(dir, bwcOpenDistroPlugin)
273+
File f = new File(dir, bwcOpenSearchPlugin)
274274
if (!f.exists()) {
275275
new URL(bwcRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }}
276276
}

alerting/src/test/kotlin/org/opensearch/alerting/bwc/AlertingBackwardsCompatibilityIT.kt

+26-32
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import org.apache.http.entity.ContentType.APPLICATION_JSON
99
import org.apache.http.entity.StringEntity
1010
import org.opensearch.alerting.ALERTING_BASE_URI
1111
import org.opensearch.alerting.AlertingRestTestCase
12-
import org.opensearch.alerting.LEGACY_OPENDISTRO_ALERTING_BASE_URI
1312
import org.opensearch.alerting.makeRequest
1413
import org.opensearch.alerting.model.Monitor
1514
import org.opensearch.common.settings.Settings
@@ -53,15 +52,15 @@ class AlertingBackwardsCompatibilityIT : AlertingRestTestCase() {
5352
val pluginNames = plugins.map { plugin -> plugin["name"] }.toSet()
5453
when (CLUSTER_TYPE) {
5554
ClusterType.OLD -> {
56-
assertTrue(pluginNames.contains("opendistro-alerting"))
55+
assertTrue(pluginNames.contains("opensearch-alerting"))
5756
createBasicMonitor()
5857
}
5958
ClusterType.MIXED -> {
6059
assertTrue(pluginNames.contains("opensearch-alerting"))
61-
verifyMonitorExists(LEGACY_OPENDISTRO_ALERTING_BASE_URI)
60+
verifyMonitorExists(ALERTING_BASE_URI)
6261
// TODO: Need to move the base URI being used here into a constant and rename ALERTING_BASE_URI to
6362
// MONITOR_BASE_URI
64-
verifyMonitorStats("/_opendistro/_alerting")
63+
verifyMonitorStats("/_plugins/_alerting")
6564
}
6665
ClusterType.UPGRADED -> {
6766
assertTrue(pluginNames.contains("opensearch-alerting"))
@@ -112,7 +111,7 @@ class AlertingBackwardsCompatibilityIT : AlertingRestTestCase() {
112111
@Throws(Exception::class)
113112
private fun createBasicMonitor() {
114113
val indexName = "test_bwc_index"
115-
val legacyMonitorString = """
114+
val bwcMonitorString = """
116115
{
117116
"type": "monitor",
118117
"name": "test_bwc_monitor",
@@ -123,51 +122,46 @@ class AlertingBackwardsCompatibilityIT : AlertingRestTestCase() {
123122
"unit": "MINUTES"
124123
}
125124
},
126-
"inputs": [
127-
{
128-
"search": {
129-
"indices": [
130-
"$indexName"
131-
],
125+
"inputs": [{
126+
"search": {
127+
"indices": ["$indexName"],
128+
"query": {
129+
"size": 0,
130+
"aggregations": {},
132131
"query": {
133-
"size": 0,
134-
"query": {
135-
"match_all": {}
136-
}
132+
"match_all": {}
137133
}
138134
}
139135
}
140-
],
141-
"triggers": [
142-
{
143-
"name": "abc",
144-
"severity": "1",
145-
"condition": {
146-
"script": {
147-
"source": "ctx.results[0].hits.total.value > 100000",
148-
"lang": "painless"
149-
}
150-
},
151-
"actions": []
152-
}
153-
]
136+
}],
137+
"triggers": [{
138+
"name": "abc",
139+
"severity": "1",
140+
"condition": {
141+
"script": {
142+
"source": "ctx.results[0].hits.total.value > 100000",
143+
"lang": "painless"
144+
}
145+
},
146+
"actions": []
147+
}]
154148
}
155149
""".trimIndent()
156150
createIndex(indexName, Settings.EMPTY)
157151

158152
val createResponse = client().makeRequest(
159153
method = "POST",
160-
endpoint = "$LEGACY_OPENDISTRO_ALERTING_BASE_URI?refresh=true",
154+
endpoint = "$ALERTING_BASE_URI?refresh=true",
161155
params = emptyMap(),
162-
entity = StringEntity(legacyMonitorString, APPLICATION_JSON)
156+
entity = StringEntity(bwcMonitorString, APPLICATION_JSON)
163157
)
164158

165159
assertEquals("Create monitor failed", RestStatus.CREATED, createResponse.restStatus())
166160
val responseBody = createResponse.asMap()
167161
val createdId = responseBody["_id"] as String
168162
val createdVersion = responseBody["_version"] as Int
169163
assertNotEquals("Create monitor response is missing id", Monitor.NO_ID, createdId)
170-
assertTrue("Create monitor reponse has incorrect version", createdVersion > 0)
164+
assertTrue("Create monitor response has incorrect version", createdVersion > 0)
171165
}
172166

173167
@Throws(Exception::class)

0 commit comments

Comments
 (0)