djangosphinxdjango-testingdjango-sphinx

How to go about testing a django app which extensively uses sphinxsearch?


I have a django powered website that uses sphinxsearch for searching and querying. The Django testing platform creates a test database against which all your test cases are tested. However my original sphinx indexer would still be indexing the original db. I wanted to know whats the best strategy to tackle this issue. I would love to know about some existing django app to solve this problem or to get some pointers about how to go about this issue.


Solution

  • Not much you have to do: Change the settings of sphinx when you run a test. If you specify the sphinx settings in your django project.settings file you would have to do this:

    1. create a sphinx testdatabase
    2. create a settings.py specifically for testing
    3. python ./manage.py test --settings=project.sphinxtest.settings

    If you specifiy your sphinx settings elsewhere, do something similar. Important is to use different settings for sphinx while testing, as there you specify the database sphinx should use.

    Without more details about your implementation, this is the most that can be said to help you...