Skip to content

Commit

Permalink
Version updates and minor test fixes (#1496)
Browse files Browse the repository at this point in the history
* Version updates and minor test fixes

* update poetry.lock

* Update dockerfile

* Test

* revert unit test change
  • Loading branch information
jleaniz authored Jun 13, 2024
1 parent 9da8379 commit 2a95c92
Show file tree
Hide file tree
Showing 8 changed files with 1,484 additions and 1,389 deletions.
1 change: 1 addition & 0 deletions docker/tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ RUN cd /home/turbinia && echo "" > password.lst
RUN cd /home/turbinia && curl -s https://raw.githubusercontent.com/danielmiessler/SecLists/285474cf9bff85f3323c5a1ae436f78acd1cb62c/Passwords/UserPassCombo-Jay.txt >> password.lst
RUN cd /home/turbinia && curl -s https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt >> password.lst
RUN cp /home/turbinia/password.lst /root/
RUN echo ':\nd' > /home/turbinia/turbinia-password-cracking.rules

# Copy Kubernetes support tool to home folder
COPY --chown=turbinia:turbinia k8s/tools/check-lockfile.py /home/turbinia/check-lockfile.py
Expand Down
2,634 changes: 1,359 additions & 1,275 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "turbinia"
version = "20240412.1"
version = "20240614"
description = "Automation and Scaling of Digital Forensics Tools"
authors = ["Turbinia Developers <[email protected]>"]
maintainers = ["Turbinia Developers <[email protected]>"]
Expand Down Expand Up @@ -49,7 +49,7 @@ google-auth-oauthlib = "^1.1.0"
mock = "*"
pytest = "*"
tabulate = "*"
turbinia-api-lib = "^1.0.2"
turbinia-api-lib = "^1.0.3"
yapf = "*"

[tool.poetry.extras]
Expand Down
2 changes: 1 addition & 1 deletion turbinia/jobs/imports_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _AssertFilesImportedInInit(self, path, ignorable_files):
module_name, _, _ = filename.partition('.')
import_expression = re.compile(r' import {0:s}\b'.format(module_name))

self.assertRegexpMatches(
self.assertRegex(
init_content, import_expression,
f'{module_name:s} not imported in {init_path:s}')

Expand Down
2 changes: 1 addition & 1 deletion turbinia/output_manager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def testGetOutputWriters(self):
output_manager.storage = mock.MagicMock()
writers = output_manager.OutputManager.get_output_writers(
self.task.name, self.task.id, self.task.request_id, remote_only=False)
self.assertEquals(len(writers), 2)
self.assertEqual(len(writers), 2)
for writer in writers:
self.assertIsInstance(writer, output_manager.OutputWriter)

Expand Down
2 changes: 1 addition & 1 deletion turbinia/redis_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def attribute_exists(self, redis_key: str, attribute_name: str) -> bool:
except redis.RedisError as exception:
error_message = (
f'Error checking existence of attribute {attribute_name}'
f'for key {redis_key}')
f' for key {redis_key}')
log.error(f'{error_message}: {exception}')
raise RedisClientError(error_message) from exception

Expand Down
19 changes: 13 additions & 6 deletions turbinia/workers/workers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ def testTurbiniaTaskSerialize(self):
self.assertEqual(out_obj.__dict__, self.plaso_task.__dict__)

@mock.patch('turbinia.redis_client.RedisClient.set_attribute')
def testTurbiniaTaskRunWrapper(self, _):
@mock.patch('turbinia.workers.TurbiniaTask.update_task_status')
def testTurbiniaTaskRunWrapper(self, _, __):
"""Test that the run wrapper executes task run."""
self.setResults()
self.result.closed = True
Expand All @@ -158,7 +159,8 @@ def testTurbiniaTaskRunWrapper(self, _):
self.result.close.assert_not_called()

@mock.patch('turbinia.redis_client.RedisClient.set_attribute')
def testTurbiniaTaskRunWrapperAutoClose(self, _):
@mock.patch('turbinia.workers.TurbiniaTask.update_task_status')
def testTurbiniaTaskRunWrapperAutoClose(self, _, __):
"""Test that the run wrapper closes the task."""
self.setResults()
new_result = self.task.run_wrapper(self.evidence.__dict__)
Expand All @@ -168,7 +170,8 @@ def testTurbiniaTaskRunWrapperAutoClose(self, _):

@mock.patch('turbinia.state_manager.get_state_manager')
@mock.patch('turbinia.redis_client.RedisClient.set_attribute')
def testTurbiniaTaskRunWrapperBadResult(self, _, __):
@mock.patch('turbinia.workers.TurbiniaTask.update_task_status')
def testTurbiniaTaskRunWrapperBadResult(self, _, __, ___):
"""Test that the run wrapper recovers from run returning bad result."""
bad_result = 'Not a TurbiniaTaskResult'
checked_result = TurbiniaTaskResult(base_output_dir=self.base_output_dir)
Expand All @@ -182,7 +185,8 @@ def testTurbiniaTaskRunWrapperBadResult(self, _, __):
self.assertIn('CheckedResult', new_result.status)

@mock.patch('turbinia.redis_client.RedisClient.set_attribute')
def testTurbiniaTaskJobUnavailable(self, _):
@mock.patch('turbinia.workers.TurbiniaTask.update_task_status')
def testTurbiniaTaskJobUnavailable(self, _, __):
"""Test that the run wrapper can fail if the job doesn't exist."""
self.setResults()
self.task.job_name = 'non_exist'
Expand All @@ -194,7 +198,8 @@ def testTurbiniaTaskJobUnavailable(self, _):
self.assertEqual(new_result.status, canary_status)

@mock.patch('turbinia.redis_client.RedisClient.set_attribute')
def testTurbiniaTaskRunWrapperExceptionThrown(self, _):
@mock.patch('turbinia.workers.TurbiniaTask.update_task_status')
def testTurbiniaTaskRunWrapperExceptionThrown(self, _, __):
"""Test that the run wrapper recovers from run throwing an exception."""
self.setResults()
self.task.run = mock.MagicMock(side_effect=TurbiniaException)
Expand Down Expand Up @@ -248,7 +253,9 @@ def testTurbiniaTaskValidateResultBadResult(self, _, __):

@mock.patch('turbinia.workers.evidence_decode')
@mock.patch('turbinia.redis_client.RedisClient.set_attribute')
def testTurbiniaTaskEvidenceValidationFailure(self, _, evidence_decode_mock):
@mock.patch('turbinia.workers.TurbiniaTask.update_task_status')
def testTurbiniaTaskEvidenceValidationFailure(
self, _, __, evidence_decode_mock):
"""Tests Task fails when evidence validation fails."""
self.setResults()
test_evidence = evidence.RawDisk()
Expand Down
Loading

0 comments on commit 2a95c92

Please sign in to comment.