@@ -61,9 +61,9 @@ def rds_utils(self):
6161 return RdsTestUtility (region )
6262
6363 @pytest .fixture (scope = 'class' )
64- def props (self ):
64+ def default_props (self ):
6565 p : Properties = Properties (
66- {"plugins" : "custom_endpoint,read_write_splitting,failover" , " connect_timeout" : 10_000 , "autocommit" : True , "cluster_id" : "cluster1" })
66+ {"connect_timeout" : 10_000 , "autocommit" : True , "cluster_id" : "cluster1" })
6767
6868 features = TestEnvironment .get_current ().get_features ()
6969 if TestEnvironmentFeatures .TELEMETRY_TRACES_ENABLED in features \
@@ -77,6 +77,18 @@ def props(self):
7777
7878 return p
7979
80+ @pytest .fixture (scope = 'class' )
81+ def props_with_failover (self , default_props ):
82+ p = default_props .copy ()
83+ p ["plugins" ] = "custom_endpoint,read_write_splitting,failover"
84+ return p
85+
86+ @pytest .fixture (scope = 'class' )
87+ def props (self , default_props ):
88+ p = default_props .copy ()
89+ p ["plugins" ] = "custom_endpoint,read_write_splitting"
90+ return p
91+
8092 @pytest .fixture (scope = 'class' , autouse = True )
8193 def setup_and_teardown (self ):
8294 env_info = TestEnvironment .get_current ().get_info ()
@@ -221,13 +233,13 @@ def wait_until_endpoint_has_members(self, rds_client, expected_members: Set[str]
221233 duration_sec = (perf_counter_ns () - start_ns ) / 1_000_000_000
222234 self .logger .debug (f"wait_until_endpoint_has_specified_members took { duration_sec } seconds." )
223235
224- def test_custom_endpoint_failover (self , test_driver : TestDriver , conn_utils , props , rds_utils ):
225- props ["failover_mode" ] = "reader_or_writer"
236+ def test_custom_endpoint_failover (self , test_driver : TestDriver , conn_utils , props_with_failover , rds_utils ):
237+ props_with_failover ["failover_mode" ] = "reader_or_writer"
226238
227239 target_driver_connect = DriverHelper .get_connect_func (test_driver )
228240 kwargs = conn_utils .get_connect_params ()
229241 kwargs ["host" ] = self .endpoint_info ["Endpoint" ]
230- conn = AwsWrapperConnection .connect (target_driver_connect , ** kwargs , ** props )
242+ conn = AwsWrapperConnection .connect (target_driver_connect , ** kwargs , ** props_with_failover )
231243
232244 endpoint_members = self .endpoint_info ["StaticMembers" ]
233245 instance_id = rds_utils .query_instance_id (conn )
@@ -281,7 +293,7 @@ def _setup_custom_endpoint_role(self, target_driver_connect, conn_kwargs, rds_ut
281293 self .logger .debug ("Custom endpoint instance successfully set to role: " + host_role .name )
282294
283295 def test_custom_endpoint_read_write_splitting__with_custom_endpoint_changes__with_reader_as_init_conn (
284- self , test_driver : TestDriver , conn_utils , props , rds_utils ):
296+ self , test_driver : TestDriver , conn_utils , props_with_failover , rds_utils ):
285297 '''
286298 Will test for the following scenario:
287299 1. Initially connect to a reader instance via the custom endpoint.
@@ -297,13 +309,13 @@ def test_custom_endpoint_read_write_splitting__with_custom_endpoint_changes__wit
297309 kwargs ["host" ] = self .endpoint_info ["Endpoint" ]
298310 # This setting is not required for the test, but it allows us to also test re-creation of expired monitors since
299311 # it takes more than 30 seconds to modify the cluster endpoint (usually around 140s).
300- props ["custom_endpoint_idle_monitor_expiration_ms" ] = 30_000
301- props ["wait_for_custom_endpoint_info_timeout_ms" ] = 30_000
312+ props_with_failover ["custom_endpoint_idle_monitor_expiration_ms" ] = 30_000
313+ props_with_failover ["wait_for_custom_endpoint_info_timeout_ms" ] = 30_000
302314
303315 # Ensure that we are starting with a reader connection
304316 self ._setup_custom_endpoint_role (target_driver_connect , kwargs , rds_utils , HostRole .READER )
305317
306- conn = AwsWrapperConnection .connect (target_driver_connect , ** kwargs , ** props )
318+ conn = AwsWrapperConnection .connect (target_driver_connect , ** kwargs , ** props_with_failover )
307319 endpoint_members = self .endpoint_info ["StaticMembers" ]
308320 original_reader_id = rds_utils .query_instance_id (conn )
309321 assert original_reader_id in endpoint_members
@@ -350,16 +362,16 @@ def test_custom_endpoint_read_write_splitting__with_custom_endpoint_changes__wit
350362
351363 def test_custom_endpoint_read_write_splitting__with_custom_endpoint_changes__with_writer_as_init_conn (
352364 self , test_driver : TestDriver , conn_utils , props , rds_utils ):
353- '''
365+ """
354366 Will test for the following scenario:
355- 1. Iniitially connect to the writer instance via the custom endpoint.
367+ 1. Initially connect to the writer instance via the custom endpoint.
356368 2. Attempt to switch to reader instance - should succeed, but will still use writer instance as reader.
357369 3. Modify the custom endpoint to add a reader instance as a static member.
358370 4. Switch to reader instance - should succeed.
359371 5. Switch back to writer instance - should succeed.
360372 6. Modify the custom endpoint to remove the reader instance as a static member.
361373 7. Attempt to switch to reader instance - should fail since the custom endpoint no longer has the reader instance.
362- '''
374+ """
363375
364376 target_driver_connect = DriverHelper .get_connect_func (test_driver )
365377 kwargs = conn_utils .get_connect_params ()
0 commit comments