Closed MyPyDavid closed 2 months ago
Sind die Tests "flaky"?
https://github.com/rdmorganiser/rdmo/pull/1061#issuecomment-2252983734
@afuetterer , any test that uses a fixture file from testing/ seems to be able to fail, but I don't think they are flaky by themselves, locally they should all pass.
I will investigate by using only the tests with the files fixture and run them on repeat.
Ref: https://github.com/pytest-dev/pytest-repeat?tab=readme-ov-file#repeating-a-test-until-failure
@afuetterer , any test that uses a fixture file from testing/ seems to be able to fail, but I don't think they are flaky by themselves, locally they should all pass.
What do you mean by fixture file? I thought about the files in the temp media root, as described above.
A "fixture file" is also the json fixtures. They live in testing as well. They are inserted into the test db at startup of the test suite. Literally every test uses them.
Here is another strange case, https://github.com/rdmorganiser/rdmo/actions/runs/10058095113/job/28047314566#step:9:394.
At first the CI failed at the e2e import option test, with the uploaded xml file and now after a re-run it fails at asserting something with settings.MEDIA_ROOT
(assert Path(settings.MEDIA_ROOT).joinpath(file_value).exists()
).
I can try to re-run it again and see if/where it will fail...
PS
Now it failed at the first one again, I made a mistake before and just needed to fix the test..
I think I found out something about the failing tests with `MEDIA_ROOT`.
I think the fixtures files
from conftest.py
needs to be added to the test args in tests that use settings.MEDIA_ROOT
, otherwise the fixtures is not used or something like that I guess...
Like so ..
def test_update(db, client, files, username, password, project_id, snapshot_id):
....
Should I add that in another PR? (not in this one right, as long as its not failing here)
Originally posted by @MyPyDavid in https://github.com/rdmorganiser/rdmo/issues/1061#issuecomment-2258018459
looks so far so good on dev-2.2.0
after the merge.
maybe some missing xml files might still lead to failing tests:
Test (Python: 3.12, DB: postgres): rdmo/management/tests/test_viewset_upload.py#L129
test_create_error[xml/elements/legacy/catalog-error-key.xml-XML Parsing Error: Missing legacy elements-editor-editor]
AssertionError: assert 'XML Parsing Error: Missing legacy elements' in
'The content of the XML file does not consist of well-formed data or markup.
XML Parsing Error: syntax error: line 1, column 0'
another case:
) from exc
E django.core.management.base.CommandError: Database test_rdmo_gw0 couldn't be flushed. Possible reasons:
E * The database isn't running or isn't configured correctly.
E * At least one of the expected database tables doesn't exist.
E * The SQL was invalid.
E Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.
/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/django/core/management/commands/flush.py:75: CommandError
=========================== short test summary info ============================
ERROR rdmo/management/tests/e2e/test_frontend_management_elements.py::test_management_navigation[chromium-helper6] - django.core.management.base.CommandError: Database test_rdmo_gw0 couldn't be flushed. Possible reasons:
* The database isn't running or isn't configured correctly.
* At least one of the expected database tables doesn't exist.
* The SQL was invalid.
Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.
Description / Beschreibung
I think some tests fail often in the Action because there are some files/fxiture files (under
testing/
for example) missing during the test run.. It happens in different test jobs and in different PRs. Do you have an idea what could cause this? Usually a re-run fixes the failing test. Do you know if this is something more common in Github Actions or would there be a way to prevent this?Should I open another issue to discuss this problem?
Originally posted by @MyPyDavid in https://github.com/rdmorganiser/rdmo/issues/1061#issuecomment-2252955458
Expected behaviour / Erwartetes Verhalten
Steps to reproduce / Schritte zum Reproduzieren
make PR>let checks run
Context / Kontext
Please state your operating system, the RDMO version, and (if applicable) the browser the error occured in.
References / Verweise
Originally posted by @afuetterer in https://github.com/rdmorganiser/rdmo/issues/1061#issuecomment-2252980501
Originally posted by @afuetterer in https://github.com/rdmorganiser/rdmo/issues/1061#issuecomment-2252983734