File tree Expand file tree Collapse file tree 1 file changed +29
-25
lines changed Expand file tree Collapse file tree 1 file changed +29
-25
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ use elasticsearch::{
27
27
} ,
28
28
StatusCode ,
29
29
} ,
30
+ indices:: { IndicesCloseParts , IndicesCreateParts , IndicesDeleteParts } ,
30
31
params:: TrackTotalHits ,
31
32
SearchParts ,
32
33
} ;
@@ -183,37 +184,40 @@ async fn call_request_timeout_supersedes_global_timeout() {
183
184
#[ tokio:: test]
184
185
async fn deprecation_warning_headers ( ) -> Result < ( ) , failure:: Error > {
185
186
let client = client:: create_default ( ) ;
186
- let _ = index_documents ( & client) . await ?;
187
+ let index = "deprecation-warnings" ;
188
+ let _delete_response = client
189
+ . indices ( )
190
+ . delete ( IndicesDeleteParts :: Index ( & [ index] ) )
191
+ . send ( )
192
+ . await ?;
193
+
194
+ let _create_response = client
195
+ . indices ( )
196
+ . create ( IndicesCreateParts :: Index ( index) )
197
+ . send ( )
198
+ . await ?;
199
+
187
200
let response = client
188
- . search ( SearchParts :: None )
189
- . body ( json ! {
190
- {
191
- "aggs" : {
192
- "test" : {
193
- "composite" : {
194
- "sources" : [
195
- {
196
- "date" : {
197
- "date_histogram" : {
198
- "field" : "date" ,
199
- "interval" : "1d" ,
200
- "format" : "yyyy-MM-dd"
201
- }
202
- }
203
- }
204
- ]
205
- }
206
- }
207
- } ,
208
- "size" : 0
209
- }
210
- } )
201
+ . indices ( )
202
+ . close ( IndicesCloseParts :: Index ( & [ index] ) )
203
+ . wait_for_active_shards ( "index-setting" )
211
204
. send ( )
212
205
. await ?;
213
206
207
+ assert_eq ! ( response. status_code( ) , StatusCode :: OK ) ;
214
208
let warnings = response. warning_headers ( ) . collect :: < Vec < & str > > ( ) ;
215
209
assert ! ( warnings. len( ) > 0 ) ;
216
- assert ! ( warnings. iter( ) . any( |& w| w. contains( "deprecated" ) ) ) ;
210
+ assert ! (
211
+ warnings. iter( ) . any( |& w| w. contains( "unsupported" ) ) ,
212
+ "warnings= {:?}" ,
213
+ & warnings
214
+ ) ;
215
+
216
+ let _delete_response = client
217
+ . indices ( )
218
+ . delete ( IndicesDeleteParts :: Index ( & [ index] ) )
219
+ . send ( )
220
+ . await ?;
217
221
218
222
Ok ( ( ) )
219
223
}
You can’t perform that action at this time.
0 commit comments