mozilla/kitsune — pull request #1568 by mythmon (2013-08-14 18:41:25+00:00)
Title: [Bug 875418] Fix ES Test architecture

There are two things wrong with ES and tests.

1. `settings_test.py` in it's current state is *not used*, because it is in the wrong place. This is causing lots of fun things, like ES_LIVE_INDEXING to be whatever you have in your other settings, probably True.
2. Index names are constants, so they can't be changed after `es_utils` is imported the first time. This can cause problems in tests, but is more of a cleanliness thing. This wasn't actively causing any problems.

This is two commits for two problems. The first solves #1 above, with `git mv kitsune/settings_test.py ./`. This might not be very visible in the diffs. The second commit changes `es_utils.READ_INDEX` to `es_utils.read_index()`, and likewise for the write setting. This touches a bunch of code, but it was mostly just a find/replace.

I saw this problem come up in this situation: before this fix, delete the ES index, but turn on ES, and then run the tests. Any test that saves a model but is not an ESTestCase should fail, because it tries to use custom analyzer that have not been set up. After this change, this should work.

This should only affect testing.

r?