@@ -281,6 +281,21 @@ async fn verify_queries_routed_to_correct_tablets(
281281 Ok ( ( ) )
282282}
283283
284+ async fn run_test_default_policy_is_tablet_aware_attempt (
285+ session : & Session ,
286+ prepared : & PreparedStatement ,
287+ value_per_tablet : & [ ( i32 , i32 ) ] ,
288+ feedback_rxs : & mut [ UnboundedReceiver < ( ResponseFrame , Option < u16 > ) > ] ,
289+ ) -> Result < ( ) , String > {
290+ populate_internal_driver_tablet_info ( session, prepared, value_per_tablet, feedback_rxs) . await ?;
291+
292+ // Now we must have info about all the tablets. It should not be
293+ // possible to receive any feedback if DefaultPolicy is properly
294+ // tablet-aware.
295+ verify_queries_routed_to_correct_tablets ( session, prepared, value_per_tablet, feedback_rxs)
296+ . await
297+ }
298+
284299/// Tests that, when using DefaultPolicy with TokenAwareness and querying table
285300/// that uses tablets:
286301/// 1. When querying data that belongs to tablet we didn't receive yet we will
@@ -334,24 +349,11 @@ async fn test_default_policy_is_tablet_aware() {
334349 }
335350
336351 let tablets = get_tablets ( & session, & ks, "t" ) . await ;
337- let value_lists = calculate_key_per_tablet ( & tablets, & prepared) ;
338-
339- populate_internal_driver_tablet_info (
340- & session,
341- & prepared,
342- & value_lists,
343- & mut feedback_rxs,
344- )
345- . await
346- . unwrap ( ) ;
347-
348- // Now we must have info about all the tablets. It should not be
349- // possible to receive any feedback if DefaultPolicy is properly
350- // tablet-aware.
351- verify_queries_routed_to_correct_tablets (
352+ let value_per_tablet = calculate_key_per_tablet ( & tablets, & prepared) ;
353+ run_test_default_policy_is_tablet_aware_attempt (
352354 & session,
353355 & prepared,
354- & value_lists ,
356+ & value_per_tablet ,
355357 & mut feedback_rxs,
356358 )
357359 . await
0 commit comments