Skip to content

Commit e12157d

Browse files
committed
ACLP Logs - Stabilize stream tests
1 parent a973cdf commit e12157d

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

test/integration/models/monitor/test_monitor_logs.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def create_stream(
337337
assert stream.id is not None
338338
assert stream.status == LogsStreamStatus.provisioning
339339
yield stream
340-
send_request_when_resource_available(timeout=100, func=stream.delete)
340+
send_request_when_resource_available(timeout=1800, func=stream.delete)
341341

342342

343343
@pytest.fixture(scope="session")
@@ -361,6 +361,25 @@ def is_stream_provisioned():
361361
yield test_linode_client.load(LogsStream, create_stream.id)
362362

363363

364+
@pytest.fixture(scope="function")
365+
def wait_for_updatable_status(
366+
test_linode_client: LinodeClient, provisioned_stream: LogsStream
367+
):
368+
"""
369+
Waits for the stream to be in an active or inactive state before a test runs.
370+
Streams can switch to `provisioning` state between updates. This makes sure the previous update is fully finished.
371+
"""
372+
373+
def is_stream_updatable():
374+
stream = test_linode_client.load(LogsStream, provisioned_stream.id)
375+
return stream.status in (
376+
LogsStreamStatus.active,
377+
LogsStreamStatus.inactive,
378+
)
379+
380+
wait_for_condition(30, 1800, is_stream_updatable)
381+
382+
364383
@_SKIP_STREAM_TESTS
365384
def test_list_streams(
366385
test_linode_client: LinodeClient, provisioned_stream: LogsStream
@@ -395,6 +414,7 @@ def test_get_stream_by_id(
395414

396415

397416
@_SKIP_STREAM_TESTS
417+
@pytest.mark.usefixtures("wait_for_updatable_status")
398418
def test_update_stream_label_and_status(
399419
test_linode_client: LinodeClient, provisioned_stream: LogsStream
400420
):
@@ -443,6 +463,7 @@ def test_update_stream_label_and_status(
443463

444464

445465
@_SKIP_STREAM_TESTS
466+
@pytest.mark.usefixtures("wait_for_updatable_status")
446467
def test_update_stream_destinations(
447468
test_linode_client: LinodeClient,
448469
provisioned_stream: LogsStream,

0 commit comments

Comments
 (0)