Add unit tests for all the Celery worker tasks.

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

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.

Commits

Files

    Loading...