Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] Use adminClient when searching system index in integ tests (#1286) #1288

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ abstract class IndexStateManagementRestTestCase : IndexManagementRestTestCase()
}
}
""".trimIndent()
val response = client().makeRequest(
val response = adminClient().makeRequest(
"POST", "$INDEX_MANAGEMENT_INDEX/_search", emptyMap(),
StringEntity(request, APPLICATION_JSON),
)
Expand All @@ -380,7 +380,7 @@ abstract class IndexStateManagementRestTestCase : IndexManagementRestTestCase()
}

protected fun getManagedIndexConfigByDocId(id: String): ManagedIndexConfig? {
val response = client().makeRequest("GET", "$INDEX_MANAGEMENT_INDEX/_doc/$id")
val response = adminClient().makeRequest("GET", "$INDEX_MANAGEMENT_INDEX/_doc/$id")
assertEquals("Request failed", RestStatus.OK, response.restStatus())
val getResponse = GetResponse.fromXContent(createParser(jsonXContent, response.entity.content))
assertTrue("Did not find managed index config", getResponse.isExists)
Expand Down Expand Up @@ -832,7 +832,7 @@ abstract class IndexStateManagementRestTestCase : IndexManagementRestTestCase()
metadataId: String,
header: BasicHeader = BasicHeader(HttpHeaders.CONTENT_TYPE, "application/json"),
): RollupMetadata {
val response = client().makeRequest("GET", "$INDEX_MANAGEMENT_INDEX/_doc/$metadataId", null, header)
val response = adminClient().makeRequest("GET", "$INDEX_MANAGEMENT_INDEX/_doc/$metadataId", null, header)
assertEquals("Unable to get rollup metadata $metadataId", RestStatus.OK, response.restStatus())

val parser = createParser(XContentType.JSON.xContent(), response.entity.content)
Expand Down Expand Up @@ -889,7 +889,7 @@ abstract class IndexStateManagementRestTestCase : IndexManagementRestTestCase()
metadataId: String,
header: BasicHeader = BasicHeader(HttpHeaders.CONTENT_TYPE, "application/json"),
): TransformMetadata {
val response = client().makeRequest("GET", "$INDEX_MANAGEMENT_INDEX/_doc/$metadataId", null, header)
val response = adminClient().makeRequest("GET", "$INDEX_MANAGEMENT_INDEX/_doc/$metadataId", null, header)
assertEquals("Unable to get transform metadata $metadataId", RestStatus.OK, response.restStatus())

val parser = createParser(XContentType.JSON.xContent(), response.entity.content)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class IndexStateManagementRestApiIT : IndexStateManagementRestTestCase() {
fun `test mappings after policy creation`() {
createRandomPolicy()

val response = client().makeRequest("GET", "/$INDEX_MANAGEMENT_INDEX/_mapping")
val response = adminClient().makeRequest("GET", "/$INDEX_MANAGEMENT_INDEX/_mapping")
val parserMap =
createParser(XContentType.JSON.xContent(), response.entity.content).map() as Map<String, Map<String, Any>>
val mappingsMap = parserMap[INDEX_MANAGEMENT_INDEX]!!["mappings"] as Map<String, Any>
Expand Down Expand Up @@ -265,7 +265,7 @@ class IndexStateManagementRestApiIT : IndexStateManagementRestTestCase() {
}
}
""".trimIndent()
val response = client().makeRequest(
val response = adminClient().makeRequest(
"POST", "$INDEX_MANAGEMENT_INDEX/_search", emptyMap(),
StringEntity(request, APPLICATION_JSON),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ abstract class RollupRestTestCase : IndexManagementRestTestCase() {
refresh: Boolean = true,
header: BasicHeader = BasicHeader(HttpHeaders.CONTENT_TYPE, "application/json"),
): RollupMetadata {
val response = client().makeRequest("GET", "$INDEX_MANAGEMENT_INDEX/_doc/$metadataId?refresh=$refresh", null, header)
val response = adminClient().makeRequest("GET", "$INDEX_MANAGEMENT_INDEX/_doc/$metadataId?refresh=$refresh", null, header)
assertEquals("Unable to get rollup metadata $metadataId", RestStatus.OK, response.restStatus())
return parseRollupMetadata(response)
}
Expand All @@ -216,7 +216,7 @@ abstract class RollupRestTestCase : IndexManagementRestTestCase() {
refresh: Boolean = true,
header: BasicHeader = BasicHeader(HttpHeaders.CONTENT_TYPE, "application/json"),
): RollupMetadata {
val response = client().makeRequest("GET", "$INDEX_MANAGEMENT_INDEX/_doc/$metadataId?routing=$routingId&refresh=$refresh", null, header)
val response = adminClient().makeRequest("GET", "$INDEX_MANAGEMENT_INDEX/_doc/$metadataId?routing=$routingId&refresh=$refresh", null, header)
assertEquals("Unable to get rollup metadata $metadataId", RestStatus.OK, response.restStatus())

return parseRollupMetadata(response)
Expand Down
Loading