@@ -32,7 +32,7 @@ def require_aclp_logs(test_linode_client: LinodeClient):
3232
3333
3434@pytest .fixture (scope = "session" )
35- def test_object_storage_key (test_linode_client : LinodeClient ):
35+ def create_object_storage_key (test_linode_client : LinodeClient ):
3636 key = test_linode_client .object_storage .keys_create (
3737 label = get_test_label (),
3838 )
@@ -43,9 +43,9 @@ def test_object_storage_key(test_linode_client: LinodeClient):
4343@pytest .fixture (scope = "session" )
4444def test_destination (
4545 test_linode_client : LinodeClient ,
46- test_object_storage_key : ObjectStorageKeys ,
46+ create_object_storage_key : ObjectStorageKeys ,
4747):
48- dest , bucket = _create_destination_with_bucket (test_linode_client , test_object_storage_key )
48+ dest , bucket = _create_destination_with_bucket (test_linode_client , create_object_storage_key )
4949 yield dest
5050 _delete_destination_with_bucket (test_linode_client , dest , bucket )
5151
@@ -121,7 +121,7 @@ def test_get_destination_by_id(test_linode_client: LinodeClient, test_destinatio
121121def test_update_destination_label_and_version_history (
122122 test_linode_client : LinodeClient ,
123123 test_destination : LogsDestination ,
124- test_object_storage_key : ObjectStorageKeys ,
124+ create_object_storage_key : ObjectStorageKeys ,
125125):
126126 """
127127 Test that a LogsDestination label can be updated via save(),
@@ -134,7 +134,7 @@ def test_update_destination_label_and_version_history(
134134 original_version = dest .version
135135 dest .label = new_label
136136 dest .details .path = new_path
137- dest .details .access_key_secret = test_object_storage_key .secret_key
137+ dest .details .access_key_secret = create_object_storage_key .secret_key
138138 dest .save ()
139139
140140 updated = test_linode_client .load (LogsDestination , test_destination .id )
@@ -250,17 +250,17 @@ def test_fails_to_create_stream_invalid_destination(test_linode_client: LinodeCl
250250
251251
252252@pytest .fixture (scope = "session" )
253- def test_secondary_destination (
253+ def create_secondary_destination (
254254 test_linode_client : LinodeClient ,
255- test_object_storage_key : ObjectStorageKeys ,
255+ create_object_storage_key : ObjectStorageKeys ,
256256):
257- dest , bucket = _create_destination_with_bucket (test_linode_client , test_object_storage_key )
257+ dest , bucket = _create_destination_with_bucket (test_linode_client , create_object_storage_key )
258258 yield dest
259259 _delete_destination_with_bucket (test_linode_client , dest , bucket )
260260
261261
262262@pytest .fixture (scope = "session" )
263- def test_stream_create (test_linode_client : LinodeClient , test_destination : LogsDestination ):
263+ def create_stream (test_linode_client : LinodeClient , test_destination : LogsDestination ):
264264 stream = test_linode_client .monitor .stream_create (
265265 label = get_test_label (),
266266 destinations = [test_destination .id ],
@@ -273,26 +273,26 @@ def test_stream_create(test_linode_client: LinodeClient, test_destination: LogsD
273273
274274
275275@pytest .fixture (scope = "session" )
276- def test_stream_active (test_linode_client : LinodeClient , test_stream_create : LogsStream ):
276+ def provisioned_stream (test_linode_client : LinodeClient , create_stream : LogsStream ):
277277 """
278278 Waits until the stream transitions out of provisioning state.
279279 NOTE: Stream provisioning can take up to 60 minutes to finish.
280280 """
281281
282282 def is_stream_provisioned ():
283- stream = test_linode_client .load (LogsStream , test_stream_create .id )
283+ stream = test_linode_client .load (LogsStream , create_stream .id )
284284 return stream .status in (LogsStreamStatus .active , LogsStreamStatus .inactive )
285285
286286 wait_for_condition (60 , 3600 , is_stream_provisioned )
287287
288- return test_linode_client .load (LogsStream , test_stream_create .id )
288+ yield test_linode_client .load (LogsStream , create_stream .id )
289289
290290
291291@pytest .mark .skipif (
292292 os .getenv (RUN_ACLP_LOGS_STREAM_TESTS , "" ).strip ().lower () not in {"yes" , "true" },
293293 reason = f"{ RUN_ACLP_LOGS_STREAM_TESTS } environment variable must be set to 'yes' or 'true'" ,
294294)
295- def test_list_streams (test_linode_client : LinodeClient , test_stream_active : LogsStream ):
295+ def test_list_streams (test_linode_client : LinodeClient , provisioned_stream : LogsStream ):
296296 """
297297 Test that listing streams returns a PaginatedList containing the previously created stream.
298298 """
@@ -303,38 +303,38 @@ def test_list_streams(test_linode_client: LinodeClient, test_stream_active: Logs
303303 assert all (isinstance (s , LogsStream ) for s in streams )
304304
305305 ids = [s .id for s in streams ]
306- assert test_stream_active .id in ids
306+ assert provisioned_stream .id in ids
307307
308308
309309@pytest .mark .skipif (
310310 os .getenv (RUN_ACLP_LOGS_STREAM_TESTS , "" ).strip ().lower () not in {"yes" , "true" },
311311 reason = f"{ RUN_ACLP_LOGS_STREAM_TESTS } environment variable must be set to 'yes' or 'true'" ,
312312)
313- def test_get_stream_by_id (test_linode_client : LinodeClient , test_stream_active : LogsStream ):
313+ def test_get_stream_by_id (test_linode_client : LinodeClient , provisioned_stream : LogsStream ):
314314 """
315315 Test that loading a stream by ID returns the correct stream with expected fields.
316316 """
317- stream = test_linode_client .load (LogsStream , test_stream_active .id )
317+ stream = test_linode_client .load (LogsStream , provisioned_stream .id )
318318
319319 assert isinstance (stream , LogsStream )
320- assert stream .id == test_stream_active .id
321- assert stream .label == test_stream_active .label
322- assert stream .status in ( LogsStreamStatus . active , LogsStreamStatus . inactive )
320+ assert stream .id == provisioned_stream .id
321+ assert stream .label == provisioned_stream .label
322+ assert stream .status == provisioned_stream . status
323323 assert len (stream .destinations ) == 1
324324
325325
326326@pytest .mark .skipif (
327327 os .getenv (RUN_ACLP_LOGS_STREAM_TESTS , "" ).strip ().lower () not in {"yes" , "true" },
328328 reason = f"{ RUN_ACLP_LOGS_STREAM_TESTS } environment variable must be set to 'yes' or 'true'" ,
329329)
330- def test_update_stream_label (test_linode_client : LinodeClient , test_stream_active : LogsStream ):
330+ def test_update_stream_label (test_linode_client : LinodeClient , provisioned_stream : LogsStream ):
331331 """
332332 Test that a LogsStream label can be updated via save() and that the version
333333 history reflects the change.
334334 """
335- new_label = test_stream_active .label + "-upd"
335+ new_label = provisioned_stream .label + "-upd"
336336
337- stream = test_linode_client .load (LogsStream , test_stream_active .id )
337+ stream = test_linode_client .load (LogsStream , provisioned_stream .id )
338338 original_label = stream .label
339339 version_before = stream .version
340340
@@ -343,15 +343,15 @@ def test_update_stream_label(test_linode_client: LinodeClient, test_stream_activ
343343 assert result is True
344344
345345 try :
346- updated = test_linode_client .load (LogsStream , test_stream_active .id )
346+ updated = test_linode_client .load (LogsStream , provisioned_stream .id )
347347 assert updated .label == new_label
348348 history = updated .history
349349 snapshot_original = next (h for h in history if h .version == version_before )
350350 snapshot_updated = next (h for h in history if h .version == updated .version )
351351
352352 assert snapshot_original .label == original_label
353353 assert snapshot_updated .label == new_label
354- assert snapshot_updated .id == test_stream_active .id
354+ assert snapshot_updated .id == provisioned_stream .id
355355 finally :
356356 # Revert to original label
357357 stream .label = original_label
@@ -362,11 +362,11 @@ def test_update_stream_label(test_linode_client: LinodeClient, test_stream_activ
362362 os .getenv (RUN_ACLP_LOGS_STREAM_TESTS , "" ).strip ().lower () not in {"yes" , "true" },
363363 reason = f"{ RUN_ACLP_LOGS_STREAM_TESTS } environment variable must be set to 'yes' or 'true'" ,
364364)
365- def test_update_stream_status (test_linode_client : LinodeClient , test_stream_active : LogsStream ):
365+ def test_update_stream_status (test_linode_client : LinodeClient , provisioned_stream : LogsStream ):
366366 """
367367 Test that a LogsStream status can be toggled between active and inactive via save().
368368 """
369- stream = test_linode_client .load (LogsStream , test_stream_active .id )
369+ stream = test_linode_client .load (LogsStream , provisioned_stream .id )
370370 original_status = stream .status
371371
372372 new_status = (
@@ -380,7 +380,7 @@ def test_update_stream_status(test_linode_client: LinodeClient, test_stream_acti
380380 assert result is True
381381
382382 try :
383- updated = test_linode_client .load (LogsStream , test_stream_active .id )
383+ updated = test_linode_client .load (LogsStream , provisioned_stream .id )
384384 assert updated .status == new_status
385385 finally :
386386 # Revert to original status
@@ -394,32 +394,32 @@ def test_update_stream_status(test_linode_client: LinodeClient, test_stream_acti
394394)
395395def test_update_stream_destinations (
396396 test_linode_client : LinodeClient ,
397- test_stream_active : LogsStream ,
397+ provisioned_stream : LogsStream ,
398398 test_destination : LogsDestination ,
399- test_secondary_destination : LogsDestination ,
399+ create_secondary_destination : LogsDestination ,
400400):
401401 """
402402 Test that a stream destination can be replaced via update_destinations(),
403403 and that history reflects the change. The API allows exactly one destination per stream.
404404 """
405- stream = test_linode_client .load (LogsStream , test_stream_active .id )
405+ stream = test_linode_client .load (LogsStream , provisioned_stream .id )
406406 original_destinations = [stream .destinations [0 ].id ]
407407 version_before = stream .version
408408
409- result = stream .update_destinations ([test_secondary_destination .id ])
409+ result = stream .update_destinations ([create_secondary_destination .id ])
410410 assert result is True
411411
412412 try :
413- updated = test_linode_client .load (LogsStream , test_stream_active .id )
413+ updated = test_linode_client .load (LogsStream , provisioned_stream .id )
414414 assert len (updated .destinations ) == 1
415- assert updated .destinations [0 ].id == test_secondary_destination .id
415+ assert updated .destinations [0 ].id == create_secondary_destination .id
416416
417417 history = updated .history
418418 snapshot_original = next (h for h in history if h .version == version_before )
419419 snapshot_updated = next (h for h in history if h .version == updated .version )
420420
421421 assert snapshot_original .destinations [0 ].id == original_destinations [0 ]
422- assert snapshot_updated .destinations [0 ].id == test_secondary_destination .id
422+ assert snapshot_updated .destinations [0 ].id == create_secondary_destination .id
423423 finally :
424424 # Revert to original destination
425425 stream .update_destinations (original_destinations )
0 commit comments