turbinia icon indicating copy to clipboard operation
turbinia copied to clipboard

[Bug]: TestTurbiniaTaskBase allows to pass Evidence Class as parameter but instantiates RawDisk anyway

Open HolzmanoLagrene opened this issue 1 year ago • 0 comments

What steps will reproduce the bug?

Using the regular developer setups as proposed in the Wiki when trying to create new Tests that do not use RawDisk as Evidence type

What is the expected behavior?

In my opinion when I look at these lines of code https://github.com/google/turbinia/blob/a56d21e4e071d54caaa5d40c573a31cf04e7a7d4/turbinia/workers/workers_test.py#L47-L49 I expect to be able to pass a Evidence type and use that in the unittest.

What do you see instead?

Looking at a couple of lines later we see this: https://github.com/google/turbinia/blob/a56d21e4e071d54caaa5d40c573a31cf04e7a7d4/turbinia/workers/workers_test.py#L70 This will, in any case, set the self.evidence object to Evidence of type RawDisk

Additional information

Not sure if this is a bug or a misunderstanding on my side, but intuitively I would expect the Evidence type class to be instantiated and assigned to self.evidence later. Something like this:

self.task_class = task_class
self.evidence_class = evidence_class
...
self.evidence = self.evidence_class()

The task_class parameter does that in the line: https://github.com/google/turbinia/blob/a56d21e4e071d54caaa5d40c573a31cf04e7a7d4/turbinia/workers/workers_test.py#L59

HolzmanoLagrene avatar Oct 12 '23 06:10 HolzmanoLagrene