Skip to content

Commit

Permalink
Fix integration test failure by allowing direct access to system inde…
Browse files Browse the repository at this point in the history
…x warning

Signed-off-by: gaobinlong <[email protected]>
  • Loading branch information
gaobinlong committed Oct 11, 2023
1 parent 4f871fd commit 6c15468
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,25 @@ abstract class PluginRestTestCase : OpenSearchRestTestCase() {
?: NotificationConfigIndex.DEFAULT_SCHEMA_VERSION
}

// only refresh the notification config index to avoid too many warnings
@Throws(IOException::class)
override fun refreshAllIndices() {
val refreshRequest = Request("POST", NotificationConfigIndex.INDEX_NAME + "/_refresh")
val requestOptions = RequestOptions.DEFAULT.toBuilder()
// Allow direct access to system index warning
requestOptions.setWarningsHandler { warnings: List<String> ->
if (warnings.isEmpty()) {
return@setWarningsHandler false
} else if (warnings.size > 1) {
return@setWarningsHandler true
} else {
return@setWarningsHandler !warnings[0].startsWith("this request accesses system indices:")
}
}
refreshRequest.setOptions(requestOptions)
client().performRequest(refreshRequest)
}

protected class ClusterSetting(val type: String, val name: String, var value: Any?) {
init {
this.value = if (value == null) "null" else "\"" + value + "\""
Expand Down

0 comments on commit 6c15468

Please sign in to comment.