Skip to content

Commit e0d650f

Browse files
committed
ACLP Logs Stream - review tweaks - pt. 3
1 parent 2b53808 commit e0d650f

1 file changed

Lines changed: 11 additions & 26 deletions

File tree

test/integration/models/monitor/test_monitor_logs.py

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
wait_for_condition,
2121
)
2222

23-
RUN_ACLP_LOGS_STREAM_TESTS = "RUN_ACLP_LOGS_STREAM_TESTS"
23+
_RUN_ACLP_LOGS_STREAM_TESTS = "RUN_ACLP_LOGS_STREAM_TESTS"
24+
_SKIP_STREAM_TESTS = pytest.mark.skipif(
25+
os.getenv(_RUN_ACLP_LOGS_STREAM_TESTS, "").strip().lower() not in {"yes", "true"},
26+
reason=f"{_RUN_ACLP_LOGS_STREAM_TESTS} environment variable must be set to 'yes' or 'true'",
27+
)
2428

2529

2630
@pytest.fixture(scope="session", autouse=True)
@@ -220,10 +224,7 @@ def test_fails_to_create_destination_empty_required_fields(test_linode_client: L
220224
)
221225

222226

223-
@pytest.mark.skipif(
224-
os.getenv(RUN_ACLP_LOGS_STREAM_TESTS, "").strip().lower() not in {"yes", "true"},
225-
reason=f"{RUN_ACLP_LOGS_STREAM_TESTS} environment variable must be set to 'yes' or 'true'",
226-
)
227+
@_SKIP_STREAM_TESTS
227228
def test_fails_to_create_stream_invalid_destination(test_linode_client: LinodeClient):
228229
"""
229230
Test that creating a stream with a non-existent destination ID results in a 400 ApiError.
@@ -288,10 +289,7 @@ def is_stream_provisioned():
288289
yield test_linode_client.load(LogsStream, create_stream.id)
289290

290291

291-
@pytest.mark.skipif(
292-
os.getenv(RUN_ACLP_LOGS_STREAM_TESTS, "").strip().lower() not in {"yes", "true"},
293-
reason=f"{RUN_ACLP_LOGS_STREAM_TESTS} environment variable must be set to 'yes' or 'true'",
294-
)
292+
@_SKIP_STREAM_TESTS
295293
def test_list_streams(test_linode_client: LinodeClient, provisioned_stream: LogsStream):
296294
"""
297295
Test that listing streams returns a PaginatedList containing the previously created stream.
@@ -306,10 +304,7 @@ def test_list_streams(test_linode_client: LinodeClient, provisioned_stream: Logs
306304
assert provisioned_stream.id in ids
307305

308306

309-
@pytest.mark.skipif(
310-
os.getenv(RUN_ACLP_LOGS_STREAM_TESTS, "").strip().lower() not in {"yes", "true"},
311-
reason=f"{RUN_ACLP_LOGS_STREAM_TESTS} environment variable must be set to 'yes' or 'true'",
312-
)
307+
@_SKIP_STREAM_TESTS
313308
def test_get_stream_by_id(test_linode_client: LinodeClient, provisioned_stream: LogsStream):
314309
"""
315310
Test that loading a stream by ID returns the correct stream with expected fields.
@@ -323,10 +318,7 @@ def test_get_stream_by_id(test_linode_client: LinodeClient, provisioned_stream:
323318
assert len(stream.destinations) == 1
324319

325320

326-
@pytest.mark.skipif(
327-
os.getenv(RUN_ACLP_LOGS_STREAM_TESTS, "").strip().lower() not in {"yes", "true"},
328-
reason=f"{RUN_ACLP_LOGS_STREAM_TESTS} environment variable must be set to 'yes' or 'true'",
329-
)
321+
@_SKIP_STREAM_TESTS
330322
def test_update_stream_label(test_linode_client: LinodeClient, provisioned_stream: LogsStream):
331323
"""
332324
Test that a LogsStream label can be updated via save() and that the version
@@ -358,10 +350,7 @@ def test_update_stream_label(test_linode_client: LinodeClient, provisioned_strea
358350
stream.save()
359351

360352

361-
@pytest.mark.skipif(
362-
os.getenv(RUN_ACLP_LOGS_STREAM_TESTS, "").strip().lower() not in {"yes", "true"},
363-
reason=f"{RUN_ACLP_LOGS_STREAM_TESTS} environment variable must be set to 'yes' or 'true'",
364-
)
353+
@_SKIP_STREAM_TESTS
365354
def test_update_stream_status(test_linode_client: LinodeClient, provisioned_stream: LogsStream):
366355
"""
367356
Test that a LogsStream status can be toggled between active and inactive via save().
@@ -388,14 +377,10 @@ def test_update_stream_status(test_linode_client: LinodeClient, provisioned_stre
388377
stream.save()
389378

390379

391-
@pytest.mark.skipif(
392-
os.getenv(RUN_ACLP_LOGS_STREAM_TESTS, "").strip().lower() not in {"yes", "true"},
393-
reason=f"{RUN_ACLP_LOGS_STREAM_TESTS} environment variable must be set to 'yes' or 'true'",
394-
)
380+
@_SKIP_STREAM_TESTS
395381
def test_update_stream_destinations(
396382
test_linode_client: LinodeClient,
397383
provisioned_stream: LogsStream,
398-
test_destination: LogsDestination,
399384
create_secondary_destination: LogsDestination,
400385
):
401386
"""

0 commit comments

Comments
 (0)