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::{
2727 } ,
2828 StatusCode ,
2929 } ,
30+ indices:: { IndicesCloseParts , IndicesCreateParts , IndicesDeleteParts } ,
3031 params:: TrackTotalHits ,
3132 SearchParts ,
3233} ;
@@ -183,37 +184,40 @@ async fn call_request_timeout_supersedes_global_timeout() {
183184#[ tokio:: test]
184185async fn deprecation_warning_headers ( ) -> Result < ( ) , failure:: Error > {
185186 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+
187200 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" )
211204 . send ( )
212205 . await ?;
213206
207+ assert_eq ! ( response. status_code( ) , StatusCode :: OK ) ;
214208 let warnings = response. warning_headers ( ) . collect :: < Vec < & str > > ( ) ;
215209 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 ?;
217221
218222 Ok ( ( ) )
219223}
You can’t perform that action at this time.
0 commit comments