From 46e8c4220c2fed08052c33361744bc6a82fba10e Mon Sep 17 00:00:00 2001 From: rootkiller6788 Date: Thu, 20 Aug 2026 03:23:41 +0800 Subject: [PATCH 1/2] Fix TestTurbiniaTaskBase to instantiate the requested evidence class The evidence_class parameter of TestTurbiniaTaskBase.setUp was stored on the instance but never used: self.evidence was always instantiated as RawDisk, so tests passing a different evidence class silently ran against the wrong type. Instantiate self.evidence_class instead. Fixes #1373 --- turbinia/workers/workers_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/turbinia/workers/workers_test.py b/turbinia/workers/workers_test.py index 7331b53ec..307801d99 100644 --- a/turbinia/workers/workers_test.py +++ b/turbinia/workers/workers_test.py @@ -61,12 +61,12 @@ def setUp(self, task_class=TurbiniaTask, evidence_class=evidence.RawDisk): self.task.output_manager.get_local_output_dirs.return_value = (None, None) self.task.get_metrics = mock.MagicMock() - # Set up RawDisk Evidence + # Set up the Evidence object. test_disk_path = tempfile.mkstemp(dir=self.base_output_dir)[1] self.remove_files.append(test_disk_path) self.test_stdout_path = tempfile.mkstemp(dir=self.base_output_dir)[1] self.remove_files.append(self.test_stdout_path) - self.evidence = evidence.RawDisk(source_path=test_disk_path) + self.evidence = self.evidence_class(source_path=test_disk_path) self.evidence.config['abort'] = False self.evidence.config['globals'] = {} self.evidence.preprocess = mock.MagicMock() From 29075d4b815a6862f83d6ca9c4f77e59f760ae19 Mon Sep 17 00:00:00 2001 From: rootkiller6788 Date: Sun, 23 Aug 2026 16:15:29 +0800 Subject: [PATCH 2/2] Use RawDisk as task input evidence in partition and photorec tests Now that TestTurbiniaTaskBase honors evidence_class (issue #1373), the partition enumeration and photorec tests were instantiating their output evidence classes (DiskPartition, PhotorecOutput) as the task input evidence. Both tasks consume a raw disk image, so pass evidence.RawDisk (the base default) as the input evidence class. Fixes the CI failures in the Turbinia Test Run workflow: - partitions_test: DiskPartition.name raised TypeError because partition_location was None - photorec_test: PhotorecTask.run accessed evidence.device_path which PhotorecOutput does not have --- turbinia/workers/partitions_test.py | 3 ++- turbinia/workers/photorec_test.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/turbinia/workers/partitions_test.py b/turbinia/workers/partitions_test.py index 74ec349ff..5923e90a3 100644 --- a/turbinia/workers/partitions_test.py +++ b/turbinia/workers/partitions_test.py @@ -20,6 +20,7 @@ from dfvfs.path import factory as path_spec_factory import mock +from turbinia import evidence from turbinia.lib import text_formatter as fmt from turbinia.workers import partitions from turbinia.workers import TurbiniaTaskResult @@ -33,7 +34,7 @@ def setUp(self): # pylint: disable=arguments-differ super(PartitionEnumerationTaskTest, self).setUp( task_class=partitions.PartitionEnumerationTask, - evidence_class=partitions.DiskPartition) + evidence_class=evidence.RawDisk) self.setResults(mock_run=False) self.task.task_config['minimum_size'] = 104857600 diff --git a/turbinia/workers/photorec_test.py b/turbinia/workers/photorec_test.py index e07bf9b55..83540b037 100644 --- a/turbinia/workers/photorec_test.py +++ b/turbinia/workers/photorec_test.py @@ -19,7 +19,7 @@ import textwrap import mock -from turbinia.evidence import PhotorecOutput +from turbinia import evidence from turbinia.workers import photorec from turbinia.workers.workers_test import TestTurbiniaTaskBase from turbinia.workers import TurbiniaTaskResult @@ -31,7 +31,7 @@ class PhotorecTaskTest(TestTurbiniaTaskBase): def setUp(self): # pylint: disable=arguments-differ super(PhotorecTaskTest, self).setUp( - task_class=photorec.PhotorecTask, evidence_class=PhotorecOutput) + task_class=photorec.PhotorecTask, evidence_class=evidence.RawDisk) self.setResults(mock_run=False) self.task.output_dir = self.task.base_output_dir