[SE-3989] - Fixes for Blockstore integration tests.

Description

  1.  

    1. Description

This pull request repairs the integration tests for Blockstore/Libraries v2 by changing updating relevant code to be compatible with the latest version of `edx-search`.

It's not known how long these tests have been broken because they are not run by Jenkins. The breakage appears to have been caused in: https://github.com/edx/edx-search/pull/104

CC: @Golub-Sergey @bradenmacdonald

  1.  

    1. Jira Ticket
      https://openedx.atlassian.net/browse/OSPR-5578

  1.  

    1. Testing instructions

Set up Blockstore, and run `make testserver` to launch the testserver. Then, in `devstack` run `make studio-shell` and run these commands, *one at a time* so you can easily see if any failed:

```
EDXAPP_TEST_ELASTICSEARCH_HOST=edx.devstack.elasticsearch7 EDXAPP_ENABLE_ELASTICSEARCH_FOR_TESTS=0 EDXAPP_RUN_BLOCKSTORE_TESTS=1 python -Wd -m pytest --ds=cms.envs.test openedx/core/lib/blockstore_api/ openedx/core/djangolib/tests/test_blockstore_cache.py openedx/core/djangoapps/content_libraries/tests/
EDXAPP_TEST_ELASTICSEARCH_HOST=edx.devstack.elasticsearch7 EDXAPP_ENABLE_ELASTICSEARCH_FOR_TESTS=0 EDXAPP_RUN_BLOCKSTORE_TESTS=1 python -Wd -m pytest --ds=lms.envs.test openedx/core/lib/blockstore_api/ openedx/core/djangolib/tests/test_blockstore_cache.py openedx/core/djangoapps/content_libraries/tests/
EDXAPP_TEST_ELASTICSEARCH_HOST=edx.devstack.elasticsearch7 EDXAPP_ENABLE_ELASTICSEARCH_FOR_TESTS=1 EDXAPP_RUN_BLOCKSTORE_TESTS=1 python -Wd -m pytest --ds=cms.envs.test openedx/core/lib/blockstore_api/ openedx/core/djangolib/tests/test_blockstore_cache.py openedx/core/djangoapps/content_libraries/tests/
EDXAPP_TEST_ELASTICSEARCH_HOST=edx.devstack.elasticsearch7 EDXAPP_ENABLE_ELASTICSEARCH_FOR_TESTS=1 EDXAPP_RUN_BLOCKSTORE_TESTS=1 python -Wd -m pytest --ds=lms.envs.test openedx/core/lib/blockstore_api/ openedx/core/djangolib/tests/test_blockstore_cache.py openedx/core/djangoapps/content_libraries/tests/

```

Note that the above are two lines more than the Blockstore integration test instructions mention. I'm not sure if it should be in the documentation there, but two codepaths exist in testing, and I needed to toggle using real elasticsearch to ensure they were both followed.

  1.  

    1. Deadline
      I'm not sure-- it's unclear to me if this has broken anything in production, but I have to assume it has. Sooner is better.

  1.  

    1. Other information

The changes which broke the integration test removed the need for specifying the document type to every operation on the search index. This seems to have assumed that a feature of `edx-search`, allowing multiple document types, was never used, and so could be eliminated.

Unfortunately, the library indexes *DID* use this feature, and because the integration tests aren't run automatically, this escaped the notice of the devs who made this change. This means to make the tests pass, and search to work as expected, I've had to create an additional index.

I don't know the full implications of having done so. I can only imagine it will mean a time-consuming reindex for someone down the line when this is merged. I also don't know if it will mean a lot of duplicated data between the indexes. Any further information and context is appreciated.

  1.  

    1. Reviewers

  • [x] @arbrandes

  • [ ] @bradenmacdonald

Activity

Show:
Braden MacDonald
February 5, 2021, 1:00 AM

I can review this one; it's just a bugfix and is related to blockstore/libraries stuff that I worked on. The author just said it's ready for review

Done

Assignee

Braden MacDonald

Reporter

Open Source Pull Request Bot

Labels

Contributor Name

Fox Piacenti

Repo

edx/edx-platform

Customer

Epic Link

None

OSCM Assignee

None

Platform Map Area (Levels 1 & 2)

None

Platform Map Area (Levels 3 & 4)

None

Blended Hour Utilization Percentage

None

edX Theme

None

edX Squad

None

Github Lines Added

53

Github Lines Deleted

50

Priority

Unset