Skip to content

Commit 6b9fee5

Browse files
committed
ACLP Logs Stream - Formatting tweaks
1 parent 2ceb3bd commit 6b9fee5

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

linode_api4/objects/monitor.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,14 +610,17 @@ def history(self):
610610
LogsDestinationHistory
611611
)
612612

613+
613614
class LogsStreamStatus(StrEnum):
614615
active = "active"
615616
inactive = "inactive"
616617
provisioning = "provisioning"
617618

619+
618620
class LogsStreamType(StrEnum):
619621
audit_logs = "audit_logs"
620622

623+
621624
@dataclass
622625
class LogsStreamDestination(JSONObject):
623626
"""
@@ -629,6 +632,7 @@ class LogsStreamDestination(JSONObject):
629632
type: Optional[LogsDestinationType] = None
630633
details: Optional[LogsDestinationDetails] = None
631634

635+
632636
class LogsStreamHistory(Base):
633637
"""
634638
Represents a read-only historical snapshot of logs Stream.
@@ -649,6 +653,7 @@ class LogsStreamHistory(Base):
649653
"version": Property(),
650654
}
651655

656+
652657
class LogsStream(Base):
653658
"""
654659
Represents a logs stream object.

test/integration/models/monitor/test_monitor_logs.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def test_fails_to_create_destination_empty_required_fields(test_linode_client: L
223223
@pytest.mark.skipif(
224224
os.getenv(RUN_ACLP_LOGS_STREAM_TESTS, "").strip().lower() not in {"yes", "true"},
225225
reason=f"{RUN_ACLP_LOGS_STREAM_TESTS} environment variable must be set to 'yes' or 'true'",
226-
)
226+
)
227227
def test_fails_to_create_stream_invalid_destination(test_linode_client: LinodeClient):
228228
"""
229229
Test that creating a stream with a non-existent destination ID results in a 400 ApiError.
@@ -264,13 +264,13 @@ def test_stream_create(test_linode_client: LinodeClient, test_destination: LogsD
264264
send_request_when_resource_available(timeout=100, func=stream.delete)
265265

266266

267-
268267
@pytest.fixture(scope="session")
269268
def test_stream_active(test_linode_client: LinodeClient, test_stream_create: LogsStream):
270269
"""
271270
Waits until the stream transitions out of provisioning state.
272271
NOTE: Stream provisioning can take up to 60 minutes to finish.
273272
"""
273+
274274
def is_stream_provisioned():
275275
stream = test_linode_client.load(LogsStream, test_stream_create.id)
276276
return stream.status in (LogsStreamStatus.active, LogsStreamStatus.inactive)
@@ -352,7 +352,6 @@ def test_update_stream_label(test_linode_client: LinodeClient, test_stream_activ
352352
updated.save()
353353

354354

355-
356355
@pytest.mark.skipif(
357356
os.getenv(RUN_ACLP_LOGS_STREAM_TESTS, "").strip().lower() not in {"yes", "true"},
358357
reason=f"{RUN_ACLP_LOGS_STREAM_TESTS} environment variable must be set to 'yes' or 'true'",

test/unit/objects/monitor_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ def test_delete_destination(self):
341341
m.call_url, "/monitor/streams/destinations/1"
342342
)
343343

344+
344345
class LogsStreamTest(ClientBaseCase):
345346
"""
346347
Tests methods for LogsStream class.
@@ -472,10 +473,10 @@ def test_update_stream_destinations(self):
472473
stream = self.client.load(LogsStream, 1)
473474

474475
with self.mock_put({}) as m:
475-
result = stream.update_destinations([1,2,3])
476+
result = stream.update_destinations([1, 2, 3])
476477

477478
self.assertEqual(m.call_url, "/monitor/streams/1")
478-
self.assertEqual(m.call_data["destinations"], [1,2,3])
479+
self.assertEqual(m.call_data["destinations"], [1, 2, 3])
479480
self.assertTrue(result)
480481

481482
def test_fail_update_stream_destinations_when_no_destination_ids_passed(self):

0 commit comments

Comments
 (0)