tempesta-tech / tempesta-test

Test suite for Tempesta FW
10 stars 4 forks source link

Rewrite tearDown methods to cleanups (addCleanup) #534

Closed voodam closed 5 months ago

voodam commented 8 months ago

Problem

tearDown assumes that code will be called only if setUp is successful (see https://github.com/python/cpython/blob/main/Lib/unittest/case.py#L639). This is not our case in most (or all) cases where tearDown is used. This problem may leads to many seemingly unrelated test failures as well as cascade failures in pipline runs.

Solution

Use cleanups instead everywhere code should be called regardless of setUp fail (on any stage). Cleanups called separately, so exeptions in it won't break another cleanups. Pay attention to cleanup order of execution though.

Why this issue probably should be prioritized

This fix easy to do and probably it will make tests way more stable.