@@ -437,11 +437,10 @@ def test_fdv2_stays_on_fdv1_after_fallback():
437437 assert flag is not None
438438
439439
440- def test_fdv2_with_file_to_polling_initializers ():
440+ def test_fdv2_initializer_should_run_until_success ():
441441 """
442- Test that FDv2 can be initialized with a file data source and a polling data source.
443- In this case the results from the file data source should be overwritten by the
444- results from the polling datasource.
442+ Test that FDv2 initializers will run in order until a successful run. Then
443+ the datasystem is expected to transition to run synchronizers.
445444 """
446445 initial_flag_data = '''
447446{
@@ -475,27 +474,29 @@ def test_fdv2_with_file_to_polling_initializers():
475474 )
476475
477476 set_on_ready = Event ()
477+ synchronizer_ran = Event ()
478478 fdv2 = FDv2 (Config (sdk_key = "dummy" ), data_system_config )
479479 count = 0
480480
481481 def listener (_ : FlagChange ):
482482 nonlocal count
483483 count += 1
484+ if count == 3 :
485+ synchronizer_ran .set ()
484486
485487 fdv2 .flag_tracker .add_listener (listener )
486488
487489 fdv2 .start (set_on_ready )
488490 assert set_on_ready .wait (1 ), "Data system did not become ready in time"
489- assert count == 2 , "Invalid initializer process"
490- fdv2 .stop ()
491+ assert synchronizer_ran .wait (1 ), "Data system did not transition to synchronizer"
491492 finally :
492493 os .remove (path )
493494
494495
495- def test_fdv2_with_polling_to_file_initializers ():
496+ def test_fdv2_should_finish_initialization_on_first_successful_initializer ():
496497 """
497- Test that when FDv2 is initialized with a polling datasource and a file datasource
498- then only the polling processor needs to run .
498+ Test that when a FDv2 initializer returns a basis and selector that the rest
499+ of the intializers will be skipped and the client starts synchronizing phase .
499500 """
500501 initial_flag_data = '''
501502{
@@ -525,7 +526,7 @@ def test_fdv2_with_polling_to_file_initializers():
525526
526527 data_system_config = DataSystemConfig (
527528 initializers = [td_initializer .build_initializer , file_ds_builder ([path ])],
528- primary_synchronizer = td_synchronizer . build_synchronizer ,
529+ primary_synchronizer = None ,
529530 )
530531
531532 set_on_ready = Event ()
0 commit comments