Skip to content

Commit 4b85297

Browse files
Make maint-notification scenario tests generic; drop ASM-specific client code
The fault injector now owns the ASM/reshard logic behind the SLOT_MIGRATE_ASM toggle, so the client no longer needs ASM-specific handling: - Remove the AsmTriggers enum and the include_asm threading (fault_injector_client.py, maint_notifications_helpers.py); GET /slot-migrate returns whatever the FI toggle decides. - Delete TestClusterClientPushNotificationsWithAsmEffectTrigger, _asm_params, the ASM_* timeouts, and the node-cache "drain until settled" loop. - Add a generic add (+1) cluster test mirroring the remove (-1) test. Pointed at an FI with SLOT_MIGRATE_ASM=on, the generic cluster tests exercise the reshard/ASM path with zero client changes (verified live: slot-shuffle + add).
1 parent 1cb947c commit 4b85297

3 files changed

Lines changed: 108 additions & 246 deletions

File tree

tests/test_scenario/fault_injector_client.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,6 @@ class SlotMigrateEffects(str, Enum):
4949
SLOT_SHUFFLE = "slot-shuffle"
5050

5151

52-
class AsmTriggers(str, Enum):
53-
"""ASM (Atomic Slot Migration) trigger names on the slot-migrate scenario.
54-
55-
These are only returned by GET /slot-migrate when include_asm=true and require an
56-
ASM-enabled cluster (asm_client_maint_notifications) + dbconfig.
57-
"""
58-
59-
MIGRATE_SLOTS = "asm_migrate_slots" # effect slot-shuffle
60-
SCALE_OUT = "asm_scale_out" # effect add
61-
SCALE_IN = "asm_scale_in" # effect remove
62-
REBALANCE = "asm_rebalance" # effect slot-shuffle
63-
64-
6552
class TopologyChangeStandaloneEffects(str, Enum):
6653
DATA_MOVEMENT_CONN_DROP = "data_movement_conn_drop"
6754
DATA_MOVEMENT_NO_CONN_DROP = "data_movement_no_conn_drop"
@@ -134,7 +121,6 @@ def get_moving_ttl(self) -> int:
134121
def get_slot_migrate_triggers(
135122
self,
136123
effect_name: SlotMigrateEffects,
137-
include_asm: bool = False,
138124
) -> Dict[str, Any]:
139125
pass
140126

@@ -378,17 +364,13 @@ def find_database_id_by_name(
378364
def get_slot_migrate_triggers(
379365
self,
380366
effect_name: SlotMigrateEffects,
381-
include_asm: bool = False,
382367
) -> Dict[str, Any]:
383368
"""Get available triggers(trigger name + db example config) for a slot migration effect.
384369
385-
When include_asm is True, the fault injector also returns the ASM triggers
386-
(asm_migrate_slots / asm_scale_out / asm_scale_in / asm_rebalance) with an
387-
ASM-enabled dbconfig.
370+
The fault injector's SLOT_MIGRATE_ASM toggle decides the trigger subset returned (ASM
371+
`reshard` when on; migrate/failover when off), so the client stays generic.
388372
"""
389373
path = f"/slot-migrate?effect={effect_name.value}&cluster_index=0"
390-
if include_asm:
391-
path += "&include_asm=true"
392374
return self._make_request("GET", path)
393375

394376
def get_topology_change_standalone_triggers(
@@ -544,7 +526,6 @@ def get_moving_ttl(self) -> int:
544526
def get_slot_migrate_triggers(
545527
self,
546528
effect_name: SlotMigrateEffects,
547-
include_asm: bool = False,
548529
) -> Dict[str, Any]:
549530
raise NotImplementedError("Not implemented for proxy server")
550531

tests/test_scenario/maint_notifications_helpers.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,9 @@ def find_database_id_by_name(
124124
def get_slot_migrate_triggers(
125125
fault_injector: FaultInjectorClient,
126126
effect_name: SlotMigrateEffects,
127-
include_asm: bool = False,
128127
) -> Dict[str, Any]:
129128
"""Get available triggers(trigger name + db example config) for a slot migration effect."""
130-
return fault_injector.get_slot_migrate_triggers(effect_name, include_asm=include_asm)
129+
return fault_injector.get_slot_migrate_triggers(effect_name)
131130

132131
@staticmethod
133132
def get_topology_change_standalone_triggers(
@@ -302,24 +301,23 @@ def generate_params(
302301
effect_names: list[SlotMigrateEffects | TopologyChangeStandaloneEffects],
303302
skip_combinations: list[tuple[SlotMigrateEffects, str]] = [],
304303
endpoint_types: Optional[list[EndpointType]] = None,
305-
include_asm: bool = False,
306304
):
307305
"""Build parametrize tuples for maint-notification scenario tests.
308306
309307
Returns a list of (effect_name, trigger, dbconfig, db_name) tuples, or
310308
(effect_name, trigger, dbconfig, db_name, endpoint_type) when endpoint_types
311309
is provided.
312310
313-
When include_asm is True, ASM triggers (asm_migrate_slots / asm_scale_out /
314-
asm_scale_in / asm_rebalance) are included for SlotMigrateEffects.
311+
The trigger subset is whatever the fault injector returns (its SLOT_MIGRATE_ASM toggle
312+
decides ASM `reshard` vs migrate/failover), so these tests stay generic.
315313
"""
316314
params = []
317315
try:
318316
logging.info(f"Extracting params for test with effect_names: {effect_names}")
319317
for effect_name in effect_names:
320318
if isinstance(effect_name, SlotMigrateEffects):
321319
triggers_data = ClusterOperations.get_slot_migrate_triggers(
322-
fault_injector_client, effect_name, include_asm=include_asm
320+
fault_injector_client, effect_name
323321
)
324322
else:
325323
triggers_data = (

0 commit comments

Comments
 (0)