Skip to content

Commit d932755

Browse files
committed
Fixing errors after rebase.
1 parent 5d37248 commit d932755

File tree

1 file changed

+36
-34
lines changed

1 file changed

+36
-34
lines changed

tests/test_scenario/test_hitless_upgrade.py

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from redis.connection import ConnectionInterface
1515
from redis.maintenance_events import (
1616
EndpointType,
17-
MaintenanceEventsConfig,
17+
MaintNotificationsConfig,
1818
MaintenanceState,
1919
)
2020
from tests.test_scenario.conftest import (
@@ -255,7 +255,7 @@ def _validate_moving_state(
255255
and conn.host != conn.orig_host_address
256256
and (
257257
configured_endpoint_type
258-
== MaintenanceEventsConfig().get_endpoint_type(conn.host, conn)
258+
== MaintNotificationsConfig().get_endpoint_type(conn.host, conn)
259259
)
260260
)
261261
)
@@ -330,7 +330,7 @@ def _validate_default_notif_disabled_state(
330330
@pytest.mark.timeout(300) # 5 minutes timeout for this test
331331
def test_receive_failing_over_and_failed_over_push_notification(
332332
self,
333-
client_maint_events: Redis,
333+
client_maint_notifications: Redis,
334334
fault_injector_client: FaultInjectorClient,
335335
endpoints_config: Dict[str, Any],
336336
):
@@ -339,7 +339,7 @@ def test_receive_failing_over_and_failed_over_push_notification(
339339
340340
"""
341341
logging.info("Creating one connection in the pool.")
342-
conn = client_maint_events.connection_pool.get_connection()
342+
conn = client_maint_notifications.connection_pool.get_connection()
343343

344344
logging.info("Executing failover command...")
345345
failover_thread = Thread(
@@ -351,24 +351,24 @@ def test_receive_failing_over_and_failed_over_push_notification(
351351

352352
logging.info("Waiting for FAILING_OVER push notifications...")
353353
ClientValidations.wait_push_notification(
354-
client_maint_events, timeout=FAILOVER_TIMEOUT, connection=conn
354+
client_maint_notifications, timeout=FAILOVER_TIMEOUT, connection=conn
355355
)
356356

357357
logging.info("Validating connection maintenance state...")
358358
assert conn.maintenance_state == MaintenanceState.MAINTENANCE
359-
assert conn._sock.gettimeout() == RELAX_TIMEOUT
359+
assert conn._sock.gettimeout() == RELAXED_TIMEOUT
360360

361361
logging.info("Waiting for FAILED_OVER push notifications...")
362362
ClientValidations.wait_push_notification(
363-
client_maint_events, timeout=FAILOVER_TIMEOUT, connection=conn
363+
client_maint_notifications, timeout=FAILOVER_TIMEOUT, connection=conn
364364
)
365365

366366
logging.info("Validating connection default states is restored...")
367367
assert conn.maintenance_state == MaintenanceState.NONE
368368
assert conn._sock.gettimeout() == CLIENT_TIMEOUT
369369

370370
logging.info("Releasing connection back to the pool...")
371-
client_maint_events.connection_pool.release(conn)
371+
client_maint_notifications.connection_pool.release(conn)
372372

373373
failover_thread.join()
374374

@@ -675,7 +675,7 @@ def test_old_connection_shutdown_during_moving(
675675
# and connected to the new address
676676
endpoint_type = EndpointType.EXTERNAL_IP
677677
logging.info("Testing old connection shutdown during MOVING")
678-
client = _get_client_maint_events(
678+
client = _get_client_maint_notifications(
679679
endpoints_config=endpoints_config, endpoint_type=endpoint_type
680680
)
681681

@@ -753,12 +753,12 @@ def execute_commands(moving_event: threading.Event, errors: Queue):
753753
if conn._sock is not None:
754754
assert conn.get_resolved_ip() == conn.host
755755
assert conn.maintenance_state == MaintenanceState.MOVING
756-
assert conn._sock.gettimeout() == RELAX_TIMEOUT
756+
assert conn._sock.gettimeout() == RELAXED_TIMEOUT
757757
assert conn.host != conn.orig_host_address
758758
assert not conn.should_reconnect()
759759
else:
760760
assert conn.maintenance_state == MaintenanceState.MOVING
761-
assert conn.socket_timeout == RELAX_TIMEOUT
761+
assert conn.socket_timeout == RELAXED_TIMEOUT
762762
assert conn.host != conn.orig_host_address
763763
assert not conn.should_reconnect()
764764

@@ -772,12 +772,12 @@ def execute_commands(moving_event: threading.Event, errors: Queue):
772772
@pytest.mark.timeout(300) # 5 minutes timeout
773773
def test_new_connections_receive_moving(
774774
self,
775-
client_maint_events: Redis,
775+
client_maint_notifications: Redis,
776776
fault_injector_client: FaultInjectorClient,
777777
endpoints_config: Dict[str, Any],
778778
):
779779
logging.info("Creating one connection in the pool.")
780-
first_conn = client_maint_events.connection_pool.get_connection()
780+
first_conn = client_maint_notifications.connection_pool.get_connection()
781781

782782
logging.info("Executing rladmin migrate command...")
783783
migrate_thread = Thread(
@@ -795,16 +795,16 @@ def test_new_connections_receive_moving(
795795
logging.info("Waiting for MIGRATING push notifications...")
796796
# this will consume the notification in the provided connection
797797
ClientValidations.wait_push_notification(
798-
client_maint_events, timeout=MIGRATE_TIMEOUT, connection=first_conn
798+
client_maint_notifications, timeout=MIGRATE_TIMEOUT, connection=first_conn
799799
)
800800

801801
self._validate_maintenance_state(
802-
client_maint_events, expected_matching_conns_count=1
802+
client_maint_notifications, expected_matching_conns_count=1
803803
)
804804

805805
logging.info("Waiting for MIGRATED push notifications on both connections ...")
806806
ClientValidations.wait_push_notification(
807-
client_maint_events, timeout=MIGRATE_TIMEOUT, connection=first_conn
807+
client_maint_notifications, timeout=MIGRATE_TIMEOUT, connection=first_conn
808808
)
809809

810810
migrate_thread.join()
@@ -820,18 +820,18 @@ def test_new_connections_receive_moving(
820820

821821
logging.info("Waiting for MOVING push notifications on random connection ...")
822822
ClientValidations.wait_push_notification(
823-
client_maint_events, timeout=BIND_TIMEOUT, connection=first_conn
823+
client_maint_notifications, timeout=BIND_TIMEOUT, connection=first_conn
824824
)
825825

826826
old_address = first_conn._sock.getpeername()[0]
827827
logging.info(f"The node address before bind: {old_address}")
828828
logging.info(
829-
"Creating new client to connect to the same node - new connections to this node should receive the moving event..."
829+
"Creating new client to connect to the same node - new connections to this node should receive the moving notification..."
830830
)
831831

832832
endpoint_type = EndpointType.EXTERNAL_IP
833-
# create new client with new pool that should also receive the moving event
834-
new_client = _get_client_maint_events(
833+
# create new client with new pool that should also receive the moving notification
834+
new_client = _get_client_maint_notifications(
835835
endpoints_config=endpoints_config,
836836
endpoint_type=endpoint_type,
837837
host_config=old_address,
@@ -841,7 +841,7 @@ def test_new_connections_receive_moving(
841841
# part of the client connection setup, so we don't need
842842
# to wait for it explicitly with wait_push_notification
843843
logging.info(
844-
"Creating one connection in the new pool that should receive the moving event."
844+
"Creating one connection in the new pool that should receive the moving notification."
845845
)
846846
new_client_conn = new_client.connection_pool.get_connection()
847847

@@ -859,17 +859,17 @@ def test_new_connections_receive_moving(
859859
new_client.connection_pool.release(new_client_conn)
860860
new_client.close()
861861

862-
client_maint_events.connection_pool.release(first_conn)
862+
client_maint_notifications.connection_pool.release(first_conn)
863863

864864
@pytest.mark.timeout(300) # 5 minutes timeout
865865
def test_new_connections_receive_migrating(
866866
self,
867-
client_maint_events: Redis,
867+
client_maint_notifications: Redis,
868868
fault_injector_client: FaultInjectorClient,
869869
endpoints_config: Dict[str, Any],
870870
):
871871
logging.info("Creating one connection in the pool.")
872-
first_conn = client_maint_events.connection_pool.get_connection()
872+
first_conn = client_maint_notifications.connection_pool.get_connection()
873873

874874
logging.info("Executing rladmin migrate command...")
875875
migrate_thread = Thread(
@@ -887,35 +887,37 @@ def test_new_connections_receive_migrating(
887887
logging.info("Waiting for MIGRATING push notifications...")
888888
# this will consume the notification in the provided connection
889889
ClientValidations.wait_push_notification(
890-
client_maint_events, timeout=MIGRATE_TIMEOUT, connection=first_conn
890+
client_maint_notifications, timeout=MIGRATE_TIMEOUT, connection=first_conn
891891
)
892892

893893
self._validate_maintenance_state(
894-
client_maint_events, expected_matching_conns_count=1
894+
client_maint_notifications, expected_matching_conns_count=1
895895
)
896896

897-
# validate that new connections will also receive the migrating event
897+
# validate that new connections will also receive the migrating notification
898898
# it should be received as part of the client connection setup flow
899899
logging.info(
900-
"Creating second connection that should receive the migrating event as well."
900+
"Creating second connection that should receive the migrating notification as well."
901901
)
902-
second_connection = client_maint_events.connection_pool.get_connection()
902+
second_connection = client_maint_notifications.connection_pool.get_connection()
903903
self._validate_maintenance_state(
904-
client_maint_events, expected_matching_conns_count=2
904+
client_maint_notifications, expected_matching_conns_count=2
905905
)
906906

907907
logging.info("Waiting for MIGRATED push notifications on both connections ...")
908908
ClientValidations.wait_push_notification(
909-
client_maint_events, timeout=MIGRATE_TIMEOUT, connection=first_conn
909+
client_maint_notifications, timeout=MIGRATE_TIMEOUT, connection=first_conn
910910
)
911911
ClientValidations.wait_push_notification(
912-
client_maint_events, timeout=MIGRATE_TIMEOUT, connection=second_connection
912+
client_maint_notifications,
913+
timeout=MIGRATE_TIMEOUT,
914+
connection=second_connection,
913915
)
914916

915917
migrate_thread.join()
916918

917-
client_maint_events.connection_pool.release(first_conn)
918-
client_maint_events.connection_pool.release(second_connection)
919+
client_maint_notifications.connection_pool.release(first_conn)
920+
client_maint_notifications.connection_pool.release(second_connection)
919921

920922
@pytest.mark.timeout(300)
921923
def test_disabled_handling_during_migrating_and_moving(

0 commit comments

Comments
 (0)