Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: unit test for tasks module #149

Open
SohamRatnaparkhi opened this issue Mar 18, 2023 · 1 comment
Open

test: unit test for tasks module #149

SohamRatnaparkhi opened this issue Mar 18, 2023 · 1 comment
Assignees

Comments

@SohamRatnaparkhi
Copy link
Member

Is your feature request related to a problem? Please describe.
This issue is in connection to issue #15
The current code-base does not have a test for tasks module.

This is a Python module that has scripts defining a Celery task named task__track_task_progress that is responsible for relaying a task run request to a remote TES (Task Execution Service) API, and then tracking the progress of the task.

Within the task, there is code for creating a database client, updating the state of the task to INITIALIZING, fetching the task log, and then tracking the task progress by continuously polling the remote TES API. The task state is updated in the database as the task progresses, and finally, once the task has finished, the document in the database is updated to reflect the final state and the output logs.

Describe the solution you'd like
The test will have following test:

  • mocks the DbDocumentConnector and tes.HTTPClient classes and the Flask app instance.
  • tests whether the update_task_state and get_document methods are called with the correct arguments
  • test whether the upsert_fields_in_root_object method is called with the correct root and arguments after the task has finished.
  • tests whether the get_task method of tes.HTTPClient is called with the correct arguments and whether the state of the task is updated correctly in the database.

Additional context
The tests will be added to test folder.

@uniqueg
Copy link
Member

uniqueg commented Mar 18, 2023

Thanks @SohamRatnaparkhi, please go ahead if you like :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants