subiquity/subiquitycore/tests
Dan Bungert 71b71425d3 async_helpers: make SingleInstanceTask.wait safer
SingleInstanceTask has distinct steps for creation of the object, and
starting the task.  If a different coroutine is waiting on the
SingleInstanceTask, it isn't safe to directly call
SingleInstanceTask.wait() as the task may or may not have been created
yet.

Existing code usage of SingleInstanceTask is in 4 categories, with
reguards to SingleInstanceTask.wait():
1) using SingleInstanceTask without using SingleInstanceTask.wait().
   This is unchanged.
2) using SingleInstanceTask.wait without a check on task is not None.
   This may be safe now, but is fragile in the face of innocent-looking
   refactors around the SingleInstanceTask.
3) using SingleInstanceTask.wait after confirming that the task is not
   None.  This is fine but a leaky abstraction.
4) directly waiting on the SingleInstanceTask.task.  Another leaky
   abstraction, but it's solving a cancellation problem.  Leaving this
   alone.

By enhancing SingleInstanceTask.wait(), cases 2 and 3 are improved.  The
code not checking the task today is made safer, and the code checking
the task today can be simplified.
2023-03-17 08:39:01 -06:00
..
__init__.py tests: s/run_coro/IsolatedAsyncioTestCase/ 2022-06-23 17:43:14 -06:00
mocks.py extend "unit" test to cover finish_install 2022-11-10 11:57:21 +13:00
parameterized.py tests: patch parameterized to handle async 2023-02-16 19:17:37 -07:00
test_async_helpers.py async_helpers: make SingleInstanceTask.wait safer 2023-03-17 08:39:01 -06:00
test_file_util.py file_util: genericize copy routine 2022-04-11 12:51:26 -06:00
test_lsb_release.py fix some easier cases of impolite language 2022-08-29 12:30:39 -06:00
test_netplan.py Fix writing of netplan configs 2018-06-07 11:46:34 -04:00
test_prober.py probert: implement os prober arg 2022-03-29 15:09:21 -06:00
test_pubsub.py pubsub: fix test fragility 2022-05-24 13:36:02 -06:00
test_utils.py debug shell: restore orig environment 2022-06-13 14:02:32 -06:00
test_view.py ui: avoid crashing when removing overlay that does not exist 2022-12-07 10:31:05 +01:00
util.py tests: s/run_coro/IsolatedAsyncioTestCase/ 2022-06-23 17:43:14 -06:00