Skip to content

Commit 9c190c0

Browse files
committed
ACLP Logs - Reduce integration tests runtime - remove unnecessary updates
1 parent e12157d commit 9c190c0

1 file changed

Lines changed: 21 additions & 40 deletions

File tree

test/integration/models/monitor/test_monitor_logs.py

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ def test_get_stream_by_id(
408408

409409
assert isinstance(stream, LogsStream)
410410
assert stream.id == provisioned_stream.id
411-
assert stream.label == provisioned_stream.label
412-
assert stream.status == provisioned_stream.status
411+
assert provisioned_stream.label in stream.label
412+
assert stream.status in (LogsStreamStatus.active, LogsStreamStatus.inactive)
413413
assert len(stream.destinations) == 1
414414

415415

@@ -439,27 +439,17 @@ def test_update_stream_label_and_status(
439439
result = stream.save()
440440
assert result is True
441441

442-
try:
443-
updated = test_linode_client.load(LogsStream, provisioned_stream.id)
444-
assert updated.label == new_label
445-
assert updated.status == new_status
442+
updated = test_linode_client.load(LogsStream, provisioned_stream.id)
443+
assert updated.label == new_label
444+
assert updated.status == new_status
446445

447-
history = updated.history
448-
snapshot_original = next(
449-
h for h in history if h.version == version_before
450-
)
451-
snapshot_updated = next(
452-
h for h in history if h.version == updated.version
453-
)
446+
history = updated.history
447+
snapshot_original = next(h for h in history if h.version == version_before)
448+
snapshot_updated = next(h for h in history if h.version == updated.version)
454449

455-
assert snapshot_original.label == original_label
456-
assert snapshot_updated.label == new_label
457-
assert snapshot_updated.id == provisioned_stream.id
458-
finally:
459-
# Revert to original label and status
460-
stream.label = original_label
461-
stream.status = original_status
462-
stream.save()
450+
assert snapshot_original.label == original_label
451+
assert snapshot_updated.label == new_label
452+
assert snapshot_updated.id == provisioned_stream.id
463453

464454

465455
@_SKIP_STREAM_TESTS
@@ -480,24 +470,15 @@ def test_update_stream_destinations(
480470
result = stream.update_destinations([create_secondary_destination.id])
481471
assert result is True
482472

483-
try:
484-
updated = test_linode_client.load(LogsStream, provisioned_stream.id)
485-
assert len(updated.destinations) == 1
486-
assert updated.destinations[0].id == create_secondary_destination.id
473+
updated = test_linode_client.load(LogsStream, provisioned_stream.id)
474+
assert len(updated.destinations) == 1
475+
assert updated.destinations[0].id == create_secondary_destination.id
487476

488-
history = updated.history
489-
snapshot_original = next(
490-
h for h in history if h.version == version_before
491-
)
492-
snapshot_updated = next(
493-
h for h in history if h.version == updated.version
494-
)
477+
history = updated.history
478+
snapshot_original = next(h for h in history if h.version == version_before)
479+
snapshot_updated = next(h for h in history if h.version == updated.version)
495480

496-
assert snapshot_original.destinations[0].id == original_destinations[0]
497-
assert (
498-
snapshot_updated.destinations[0].id
499-
== create_secondary_destination.id
500-
)
501-
finally:
502-
# Revert to original destination
503-
stream.update_destinations(original_destinations)
481+
assert snapshot_original.destinations[0].id == original_destinations[0]
482+
assert (
483+
snapshot_updated.destinations[0].id == create_secondary_destination.id
484+
)

0 commit comments

Comments
 (0)