openwisp-controller
openwisp-controller copied to clipboard
[tests] Fix flaky tests
I have observed that CI build for Python==3.7 | django~=3.0.0 fails sometimes abruptly.
One of such occurrence is https://github.com/openwisp/openwisp-controller/pull/421/checks?check_run_id=2622952481
Let's use this issue to report such flaky tests and fix them all at once.
Build fail: https://github.com/openwisp/openwisp-controller/runs/2719061481
======================================================================
FAIL: test_ca_queryset (openwisp2.sample_pki.tests.TestAdmin) [ca2]
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/openwisp_users/tests/utils.py", line 99, in _test_multitenant_admin
msg_prefix='[operator not-contains]',
File "/opt/hostedtoolcache/Python/3.7.10/x64/lib/python3.7/site-packages/django/test/testcases.py", line 465, in assertNotContains
self.assertEqual(real_count, 0, msg_prefix + "Response should not contain %s" % text_repr)
AssertionError: 1 != 0 : [operator not-contains]: Response should not contain 'ca2'
This build failed randomly but doesn't look like the same issue: https://github.com/openwisp/openwisp-controller/runs/3138770831