Skip to content

Commit f562179

Browse files
committed
fix: clean up stale channel types before each channel type test
The 50 channel type limit is permanently saturated across parallel CI runners. Retry alone can't help -- we need to actively free slots by deleting non-builtin types before creating new ones.
1 parent c7f099d commit f562179

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_chat_misc.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,27 @@ def test_query_future_channel_bans(client: Stream, random_users):
390390
pass
391391

392392

393+
BUILTIN_CHANNEL_TYPES = frozenset({
394+
"messaging", "livestream", "team", "gaming", "commerce",
395+
})
396+
397+
398+
def _cleanup_test_channel_types(client: Stream):
399+
"""Delete non-builtin channel types to free slots for test runs."""
400+
resp = client.chat.list_channel_types()
401+
for name in resp.data.channel_types:
402+
if name not in BUILTIN_CHANNEL_TYPES:
403+
try:
404+
client.chat.delete_channel_type(name=name)
405+
except Exception:
406+
pass
407+
time.sleep(2)
408+
409+
393410
@retry_on_transient_error()
394411
def test_create_channel_type(client: Stream):
395412
"""Create a channel type with custom settings."""
413+
_cleanup_test_channel_types(client)
396414
type_name = f"testtype{uuid.uuid4().hex[:8]}"
397415

398416
try:
@@ -418,6 +436,7 @@ def test_create_channel_type(client: Stream):
418436
@retry_on_transient_error()
419437
def test_update_channel_type_mark_messages_pending(client: Stream):
420438
"""Update a channel type with mark_messages_pending=True."""
439+
_cleanup_test_channel_types(client)
421440
type_name = f"testtype{uuid.uuid4().hex[:8]}"
422441

423442
try:
@@ -451,6 +470,7 @@ def test_update_channel_type_mark_messages_pending(client: Stream):
451470
@retry_on_transient_error()
452471
def test_update_channel_type_push_notifications(client: Stream):
453472
"""Update a channel type with push_notifications=False."""
473+
_cleanup_test_channel_types(client)
454474
type_name = f"testtype{uuid.uuid4().hex[:8]}"
455475

456476
try:
@@ -484,6 +504,7 @@ def test_update_channel_type_push_notifications(client: Stream):
484504
@retry_on_transient_error()
485505
def test_delete_channel_type(client: Stream):
486506
"""Create and delete a channel type with retry."""
507+
_cleanup_test_channel_types(client)
487508
type_name = f"testdeltype{uuid.uuid4().hex[:8]}"
488509

489510
client.chat.create_channel_type(

0 commit comments

Comments
 (0)