Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing tests #1960

Merged
merged 9 commits into from
Apr 29, 2024
Merged

Fix failing tests #1960

merged 9 commits into from
Apr 29, 2024

Conversation

black3r
Copy link
Contributor

@black3r black3r commented Apr 28, 2024

fixes #1917

this PR does the following:

  • sets up Solr to work with Github Actions testing (using a setup script inspired by start-solr-test-server.sh and Set container URLs for tests running in GitHub Actions #1921) This setup script is also usable to run the test locally (for example with running solr with docker run -it --rm -p 9001:8983 solr:6)
  • fixes tox.ini to properly configure tox-gh-actions
    • Tox in current master doesn't pick up the DJANGO env var set up by github actions, so it doesn't set up django according to tox.ini but instead just installs the Django>=3.2 specified in setup.py ending up with all the tests running with Django 4.2, this fixes that...
    • I removed pypy3 from tox.ini because it seems unused currently. If it's actually needed, let me know and I will re-add it and add it to the github actions test.yml too...
  • fixes individual failing tests
    • some tests were failing because haystack indexes weren't reset between the runs (= they would run okay individually but would error if they were ran after other test cases)..., maybe a better systemic solution would be to create a HaystackTestCase which would call the .reset() method on all indexes in its setUpClass method, similar to what django's TestCase does with databases, and subclass that for every testcase... for now I just fixed that in the affected tests...
    • test for management command build_solr_schema used to depend on Solr server being set up locally, but for testing this command we don't actually need a live Solr server, we can mock the Solr server instead...

@cclauss cclauss requested review from acdha and claudep April 29, 2024 04:54
Copy link
Contributor

@claudep claudep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that looks great! Now can you explain why the test runs shown by GitHub are only run for Python 3.8/3.9, Django 3.2/4.2 and ES?

@cclauss
Copy link
Contributor

cclauss commented Apr 29, 2024

the test runs shown by GitHub are only run for Python 3.8/3.9, Django 3.2/4.2, and ES?

@black3r and I have agreed that we will make small moves so pull requests will be as small as possible to ease the code review process.

@cclauss cclauss requested a review from claudep April 29, 2024 06:32
@black3r
Copy link
Contributor Author

black3r commented Apr 29, 2024

Wow, that looks great! Now can you explain why the test runs shown by GitHub are only run for Python 3.8/3.9, Django 3.2/4.2 and ES?

As the project is set up right now, the tests are started by GitHub actions and then handed over to Tox. So which tests are started is decided in .github/actions/test.yml. I didn't want to change this for now, but since there are more python and django versions defined in tox.ini, I prepared the tox.ini to accept all of them from GitHub Actions if we change that later...

Copy link
Contributor

@claudep claudep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining, this looks so promising 🥇

@claudep claudep merged commit a1ef180 into django-haystack:master Apr 29, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need Help: GitHub Actions tests are failing
3 participants