@@ -16,6 +16,7 @@ import org.opensearch.cluster.ClusterName
16
16
import org.opensearch.cluster.service.ClusterService
17
17
import org.opensearch.common.settings.ClusterSettings
18
18
import org.opensearch.common.settings.Settings
19
+ import org.opensearch.http.HttpTransportSettings.SETTING_HTTP_MAX_CONTENT_LENGTH
19
20
import org.opensearch.notifications.core.NotificationCorePlugin
20
21
import org.opensearch.notifications.core.setting.PluginSettings
21
22
@@ -32,6 +33,7 @@ internal class PluginSettingsTests {
32
33
private val httpMaxConnectionPerRouteKey = " $httpKeyPrefix .max_connection_per_route"
33
34
private val httpConnectionTimeoutKey = " $httpKeyPrefix .connection_timeout"
34
35
private val httpSocketTimeoutKey = " $httpKeyPrefix .socket_timeout"
36
+ private val maxHttpResponseSizeKey = " $keyPrefix .max_http_response_size"
35
37
private val legacyAlertingHostDenyListKey = " opendistro.destination.host.deny_list"
36
38
private val alertingHostDenyListKey = " plugins.destination.host.deny_list"
37
39
private val httpHostDenyListKey = " $httpKeyPrefix .host_deny_list"
@@ -48,6 +50,7 @@ internal class PluginSettingsTests {
48
50
.put(httpMaxConnectionPerRouteKey, 20 )
49
51
.put(httpConnectionTimeoutKey, 5000 )
50
52
.put(httpSocketTimeoutKey, 50000 )
53
+ .put(maxHttpResponseSizeKey, SETTING_HTTP_MAX_CONTENT_LENGTH .getDefault(Settings .EMPTY ).getBytes().toInt())
51
54
.putList(httpHostDenyListKey, emptyList<String >())
52
55
.putList(
53
56
allowedConfigTypeKey,
@@ -91,6 +94,7 @@ internal class PluginSettingsTests {
91
94
PluginSettings .MAX_CONNECTIONS_PER_ROUTE ,
92
95
PluginSettings .CONNECTION_TIMEOUT_MILLISECONDS ,
93
96
PluginSettings .SOCKET_TIMEOUT_MILLISECONDS ,
97
+ PluginSettings .MAX_HTTP_RESPONSE_SIZE ,
94
98
PluginSettings .ALLOWED_CONFIG_TYPES ,
95
99
PluginSettings .TOOLTIP_SUPPORT ,
96
100
PluginSettings .HOST_DENY_LIST
@@ -118,6 +122,10 @@ internal class PluginSettingsTests {
118
122
defaultSettings[httpSocketTimeoutKey],
119
123
PluginSettings .socketTimeout.toString()
120
124
)
125
+ Assertions .assertEquals(
126
+ defaultSettings[maxHttpResponseSizeKey],
127
+ PluginSettings .maxHttpResponseSize.toString()
128
+ )
121
129
Assertions .assertEquals(
122
130
defaultSettings[allowedConfigTypeKey],
123
131
PluginSettings .allowedConfigTypes.toString()
@@ -145,6 +153,7 @@ internal class PluginSettingsTests {
145
153
.put(httpMaxConnectionPerRouteKey, 100 )
146
154
.put(httpConnectionTimeoutKey, 100 )
147
155
.put(httpSocketTimeoutKey, 100 )
156
+ .put(maxHttpResponseSizeKey, 20000000 )
148
157
.putList(httpHostDenyListKey, listOf (" sample" ))
149
158
.putList(allowedConfigTypeKey, listOf (" slack" ))
150
159
.put(tooltipSupportKey, false )
@@ -163,6 +172,7 @@ internal class PluginSettingsTests {
163
172
PluginSettings .MAX_CONNECTIONS_PER_ROUTE ,
164
173
PluginSettings .CONNECTION_TIMEOUT_MILLISECONDS ,
165
174
PluginSettings .SOCKET_TIMEOUT_MILLISECONDS ,
175
+ PluginSettings .MAX_HTTP_RESPONSE_SIZE ,
166
176
PluginSettings .ALLOWED_CONFIG_TYPES ,
167
177
PluginSettings .TOOLTIP_SUPPORT ,
168
178
PluginSettings .HOST_DENY_LIST ,
@@ -191,6 +201,14 @@ internal class PluginSettingsTests {
191
201
100 ,
192
202
clusterService.clusterSettings.get(PluginSettings .CONNECTION_TIMEOUT_MILLISECONDS )
193
203
)
204
+ Assertions .assertEquals(
205
+ 100 ,
206
+ clusterService.clusterSettings.get(PluginSettings .SOCKET_TIMEOUT_MILLISECONDS )
207
+ )
208
+ Assertions .assertEquals(
209
+ 20000000 ,
210
+ clusterService.clusterSettings.get(PluginSettings .MAX_HTTP_RESPONSE_SIZE )
211
+ )
194
212
Assertions .assertEquals(
195
213
listOf (" sample" ),
196
214
clusterService.clusterSettings.get(PluginSettings .HOST_DENY_LIST )
@@ -224,6 +242,7 @@ internal class PluginSettingsTests {
224
242
PluginSettings .MAX_CONNECTIONS_PER_ROUTE ,
225
243
PluginSettings .CONNECTION_TIMEOUT_MILLISECONDS ,
226
244
PluginSettings .SOCKET_TIMEOUT_MILLISECONDS ,
245
+ PluginSettings .MAX_HTTP_RESPONSE_SIZE ,
227
246
PluginSettings .ALLOWED_CONFIG_TYPES ,
228
247
PluginSettings .TOOLTIP_SUPPORT ,
229
248
PluginSettings .HOST_DENY_LIST ,
@@ -252,6 +271,14 @@ internal class PluginSettingsTests {
252
271
defaultSettings[httpConnectionTimeoutKey],
253
272
clusterService.clusterSettings.get(PluginSettings .CONNECTION_TIMEOUT_MILLISECONDS ).toString()
254
273
)
274
+ Assertions .assertEquals(
275
+ defaultSettings[httpSocketTimeoutKey],
276
+ clusterService.clusterSettings.get(PluginSettings .SOCKET_TIMEOUT_MILLISECONDS ).toString()
277
+ )
278
+ Assertions .assertEquals(
279
+ defaultSettings[maxHttpResponseSizeKey],
280
+ clusterService.clusterSettings.get(PluginSettings .MAX_HTTP_RESPONSE_SIZE ).toString()
281
+ )
255
282
Assertions .assertEquals(
256
283
defaultSettings[httpHostDenyListKey],
257
284
clusterService.clusterSettings.get(PluginSettings .HOST_DENY_LIST ).toString()
@@ -290,6 +317,7 @@ internal class PluginSettingsTests {
290
317
PluginSettings .MAX_CONNECTIONS_PER_ROUTE ,
291
318
PluginSettings .CONNECTION_TIMEOUT_MILLISECONDS ,
292
319
PluginSettings .SOCKET_TIMEOUT_MILLISECONDS ,
320
+ PluginSettings .MAX_HTTP_RESPONSE_SIZE ,
293
321
PluginSettings .ALLOWED_CONFIG_TYPES ,
294
322
PluginSettings .TOOLTIP_SUPPORT ,
295
323
PluginSettings .LEGACY_ALERTING_HOST_DENY_LIST ,
@@ -325,6 +353,7 @@ internal class PluginSettingsTests {
325
353
PluginSettings .MAX_CONNECTIONS_PER_ROUTE ,
326
354
PluginSettings .CONNECTION_TIMEOUT_MILLISECONDS ,
327
355
PluginSettings .SOCKET_TIMEOUT_MILLISECONDS ,
356
+ PluginSettings .MAX_HTTP_RESPONSE_SIZE ,
328
357
PluginSettings .ALLOWED_CONFIG_TYPES ,
329
358
PluginSettings .TOOLTIP_SUPPORT ,
330
359
PluginSettings .LEGACY_ALERTING_HOST_DENY_LIST ,
@@ -359,6 +388,7 @@ internal class PluginSettingsTests {
359
388
PluginSettings .MAX_CONNECTIONS_PER_ROUTE ,
360
389
PluginSettings .CONNECTION_TIMEOUT_MILLISECONDS ,
361
390
PluginSettings .SOCKET_TIMEOUT_MILLISECONDS ,
391
+ PluginSettings .MAX_HTTP_RESPONSE_SIZE ,
362
392
PluginSettings .ALLOWED_CONFIG_TYPES ,
363
393
PluginSettings .TOOLTIP_SUPPORT ,
364
394
PluginSettings .LEGACY_ALERTING_HOST_DENY_LIST ,
0 commit comments