Repository navigation
Run unit tests without the Elasticsearch data load - #599
Merged
Merged
Conversation
Move the heartbeat check, which calls the live index, into the integration suite. Load the test dump only before integration tests, and run those against the API. Skip the old v1 integration module. Co-authored-by: Joseph Rhoads <jrhoads@users.noreply.github.com>
The HTTP integration suites expect a full public corpus and fail against the CI test dump. Heartbeat only needs the indexed organizations-v2 index. Co-authored-by: Joseph Rhoads <jrhoads@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Let the unit suite run without loading the Elasticsearch dump, and run the heartbeat check only after that dump is indexed.
Approach
The heartbeat view is the unit test that talks to the live index. Move it into
tests_integration, which runs aftermanage.py setup. Runtests_unitbefore that load. In CI, runtests_integration.tests_heartbeatafter the load. Leave the HTTP integration modules andtests_functionalcommented out: they expect a full public corpus (specific ROR IDs and more than 50,000 records), and the CI test dump does not contain that. Skip the old v1 integration class, which still expects the removed response shape.Key Modifications
HeartbeatViewTestCasefromtests_unitand add it undertests_integration, checkingGET /heartbeatagainst the indexed data.manage.py setupin.github/workflows/run_tests.yml.rorapi.tests.tests_integration.tests_heartbeat.tests_integration/tests.py(APITestCase) because it asserts the v1nameandcountry.country_codefields.Important Technical Details
organizations-v2exists. Without the dump, that test fails, which is why it cannot stay in the unit suite.tests_v2,tests_search_v2, andtests_matching_v2call the HTTP API and assert records that are not in the CI dump. Turning the whole package on failed those assertions. They stay commented, with that reason in the workflow.tests_functionalstays disabled until its evaluation harness passes.Types of changes
Test plan
tests_unitpasses without the data loadmanage.py setupReviewer, please remember our guidelines: