@@ -211,9 +211,8 @@ def test_log_collector_parses_commands_in_manifest(self):
211
211
diskinfo,""" .format (folder_to_list , file_to_collect )
212
212
213
213
with patch ("azurelinuxagent.ga.logcollector.MANIFEST_NORMAL" , manifest ):
214
- with patch ('azurelinuxagent.ga.logcollector.LogCollector._initialize_telemetry' ):
215
- log_collector = LogCollector ()
216
- archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
214
+ log_collector = LogCollector ()
215
+ archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
217
216
218
217
with open (self .output_results_file_path , "r" ) as fh :
219
218
results = fh .readlines ()
@@ -241,9 +240,8 @@ def test_log_collector_uses_full_manifest_when_full_mode_enabled(self):
241
240
""" .format (file_to_collect )
242
241
243
242
with patch ("azurelinuxagent.ga.logcollector.MANIFEST_FULL" , manifest ):
244
- with patch ('azurelinuxagent.ga.logcollector.LogCollector._initialize_telemetry' ):
245
- log_collector = LogCollector (is_full_mode = True )
246
- archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
243
+ log_collector = LogCollector (is_full_mode = True )
244
+ archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
247
245
248
246
self ._assert_archive_created (archive )
249
247
self ._assert_files_are_in_archive (expected_files = [file_to_collect ])
@@ -256,9 +254,8 @@ def test_log_collector_should_collect_all_files(self):
256
254
# All files in the manifest should be collected, since none of them are over the individual file size limit,
257
255
# and combined they do not cross the archive size threshold.
258
256
259
- with patch ('azurelinuxagent.ga.logcollector.LogCollector._initialize_telemetry' ):
260
- log_collector = LogCollector ()
261
- archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
257
+ log_collector = LogCollector ()
258
+ archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
262
259
263
260
self ._assert_archive_created (archive )
264
261
@@ -282,9 +279,8 @@ def test_log_collector_should_collect_all_files(self):
282
279
def test_log_collector_should_truncate_large_text_files_and_ignore_large_binary_files (self ):
283
280
# Set the size limit so that some files are too large to collect in full.
284
281
with patch ("azurelinuxagent.ga.logcollector._FILE_SIZE_LIMIT" , SMALL_FILE_SIZE ):
285
- with patch ('azurelinuxagent.ga.logcollector.LogCollector._initialize_telemetry' ):
286
- log_collector = LogCollector ()
287
- archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
282
+ log_collector = LogCollector ()
283
+ archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
288
284
289
285
self ._assert_archive_created (archive )
290
286
@@ -323,9 +319,8 @@ def test_log_collector_should_prioritize_important_files_if_archive_too_big(self
323
319
324
320
with patch ("azurelinuxagent.ga.logcollector._UNCOMPRESSED_ARCHIVE_SIZE_LIMIT" , 10 * 1024 * 1024 ):
325
321
with patch ("azurelinuxagent.ga.logcollector._MUST_COLLECT_FILES" , must_collect_files ):
326
- with patch ('azurelinuxagent.ga.logcollector.LogCollector._initialize_telemetry' ):
327
- log_collector = LogCollector ()
328
- archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
322
+ log_collector = LogCollector ()
323
+ archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
329
324
330
325
self ._assert_archive_created (archive )
331
326
@@ -382,9 +377,8 @@ def test_log_collector_should_prioritize_important_files_if_archive_too_big(self
382
377
def test_log_collector_should_update_archive_when_files_are_new_or_modified_or_deleted (self ):
383
378
# Ensure the archive reflects the state of files on the disk at collection time. If a file was updated, it
384
379
# needs to be updated in the archive, deleted if removed from disk, and added if not previously seen.
385
- with patch ('azurelinuxagent.ga.logcollector.LogCollector._initialize_telemetry' ):
386
- log_collector = LogCollector ()
387
- first_archive , first_uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
380
+ log_collector = LogCollector ()
381
+ first_archive , first_uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
388
382
self ._assert_archive_created (first_archive )
389
383
390
384
# Everything should be in the archive
@@ -461,9 +455,8 @@ def test_log_collector_should_clean_up_uncollected_truncated_files(self):
461
455
with patch ("azurelinuxagent.ga.logcollector._UNCOMPRESSED_ARCHIVE_SIZE_LIMIT" , 2 * SMALL_FILE_SIZE ):
462
456
with patch ("azurelinuxagent.ga.logcollector._MUST_COLLECT_FILES" , must_collect_files ):
463
457
with patch ("azurelinuxagent.ga.logcollector._FILE_SIZE_LIMIT" , SMALL_FILE_SIZE ):
464
- with patch ('azurelinuxagent.ga.logcollector.LogCollector._initialize_telemetry' ):
465
- log_collector = LogCollector ()
466
- archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
458
+ log_collector = LogCollector ()
459
+ archive , uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
467
460
468
461
self ._assert_archive_created (archive )
469
462
@@ -490,9 +483,8 @@ def test_log_collector_should_clean_up_uncollected_truncated_files(self):
490
483
with patch ("azurelinuxagent.ga.logcollector._UNCOMPRESSED_ARCHIVE_SIZE_LIMIT" , 2 * SMALL_FILE_SIZE ):
491
484
with patch ("azurelinuxagent.ga.logcollector._MUST_COLLECT_FILES" , must_collect_files ):
492
485
with patch ("azurelinuxagent.ga.logcollector._FILE_SIZE_LIMIT" , SMALL_FILE_SIZE ):
493
- with patch ('azurelinuxagent.ga.logcollector.LogCollector._initialize_telemetry' ):
494
- log_collector = LogCollector ()
495
- second_archive , second_uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
486
+ log_collector = LogCollector ()
487
+ second_archive , second_uncompressed_file_size = log_collector .collect_logs_and_get_archive ()
496
488
497
489
expected_files = [
498
490
os .path .join (self .root_collect_dir , "waagent.log" ),
0 commit comments