Add unit tests for all the Celery worker tasks.

Review Request #11534 — Created March 18, 2021 and submitted

Information

ReviewBot
release-3.0.x

Reviewers

These tests cover the RunTool and update_tools_list tasks, with all
possible success and error conditions, helping ensure we don't break
this code path as we iterate on code.

Celery tasks can be somewhat tricky to test, as there isn't a standard
way of doing this, but in our case it's not too difficult. For
RunTool, We just needed to hijack part of the process to inject a
custom delivery_info with the routing key that maps to the tool to
run.

These tests work on Celery 3.x (Python 2.7) and 4.x (Python 3).

Since much of these task code paths involve talking to the API, this
change also provides a bunch of stubbed-out resources that either do
nothing or chain to other resoureces that we can spy on.

Unit tests pass for Python 2.7 and 3.x, on Celery 3.x and 4.x.

Summary ID
Add unit tests for all the Celery worker tasks.
These tests cover the `RunTool` and `update_tools_list` tasks, with all possible success and error conditions, helping ensure we don't break this code path as we iterate on code. Celery tasks can be somewhat tricky to test, as there isn't a standard way of doing this, but in our case it's not too difficult. For `RunTool`, We just needed to hijack part of the process to inject a custom `delivery_info` with the routing key that maps to the tool to run. These tests work on Celery 3.x (Python 2.7) and 4.x (Python 3). Since much of these task code paths involve talking to the API, this change also provides a bunch of stubbed-out resources that either do nothing or chain to other resoureces that we can spy on.
ab9581604efe1cea74148afd10f1888597a8ef48
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (ac5a26c)