Skip to content

Commit

Permalink
Fix more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Sep 10, 2024
1 parent e52a81e commit b24a1b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ abstract class SnapshotManagementRestTestCase : IndexManagementRestTestCase() {
val startTimeMillis = desiredStartTimeMillis ?: (now().toEpochMilli() - millis)
val waitForActiveShards = if (isMultiNode) "all" else "1"
val response =
client().makeRequest(
adminClient().makeRequest(
"POST", "$INDEX_MANAGEMENT_INDEX/_update/${update.id}?wait_for_active_shards=$waitForActiveShards",
StringEntity(
"{\"doc\":{\"sm_policy\":{\"schedule\":{\"interval\":{\"start_time\":\"$startTimeMillis\"}}}}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package org.opensearch.indexmanagement.snapshotmanagement.resthandler

import org.opensearch.client.Request
import org.opensearch.client.ResponseException
import org.opensearch.common.xcontent.XContentType
import org.opensearch.core.rest.RestStatus
Expand Down Expand Up @@ -141,7 +142,8 @@ class RestExplainSnapshotManagementIT : SnapshotManagementRestTestCase() {

fun `test explain sm policy when config index doesn't exist`() {
try {
deleteIndex(INDEX_MANAGEMENT_INDEX)
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
adminClient().performRequest(deleteISMIndexRequest)
explainSMPolicy(randomAlphaOfLength(10))
fail("expected response exception")
} catch (e: ResponseException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package org.opensearch.indexmanagement.snapshotmanagement.resthandler

import org.opensearch.client.Request
import org.opensearch.client.ResponseException
import org.opensearch.common.xcontent.XContentType
import org.opensearch.core.rest.RestStatus
Expand Down Expand Up @@ -130,7 +131,8 @@ class RestIndexSnapshotManagementIT : SnapshotManagementRestTestCase() {
@Throws(Exception::class)
@Suppress("UNCHECKED_CAST")
fun `test mappings after sm policy creation`() {
deleteIndex(INDEX_MANAGEMENT_INDEX)
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
adminClient().performRequest(deleteISMIndexRequest)
createSMPolicy(randomSMPolicy())

val response = client().makeRequest("GET", "/$INDEX_MANAGEMENT_INDEX/_mapping")
Expand Down

0 comments on commit b24a1b1

Please sign in to comment.