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

[#13173] Fix SearchAccountRequestsActionTest #13257

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jasonqiu212
Copy link
Contributor

@jasonqiu212 jasonqiu212 commented Mar 6, 2025

Fixes #13173

Credits to @domoberzin for helping me debug this!

Problem

  • SearchAccountRequestsActionTest inserts Datastore-version of account request documents into Solr via putDocuments(dataBundle)
  • SearchAccountRequestsAction searches using sqlLogic.searchAccountRequestsInWholeSystem, which leads to sqlsearch.AccountRequestSearchManager::getEntityFromDocument getting called. But since Solr only contains Datastore-version account request documents (which do not have UUID as ID), it will lead to an IllegalArgumentException when trying to parse the ID into a UUID.

Solution

  • Revert sqlsearch.AccountRequestSearchManager::getEntityFromDocument to get account request using email and institute, instead of ID, since email and institute already uniquely identifies an account request

Testing

Run the following command:

./gradlew unitTests --tests SearchAccountRequestsActionTest
Screenshot 2025-03-06 at 7 08 50 PM

Notes

  • Still not really sure why this test fails when running individually, but passes when running together with the other unit tests
  • There are 2 versions of AccountRequestSearchManager: 1 for Datastore and 1 for SQL. Both versions are called to find account requests from Solr in SearchAccountRequestsAction. But only Datastore-version account request documents are inserted. Do we need to insert in the SQL-version account request documents as well? If yes, XXXSearchManager needs a way to differentiate between Datastore-version documents and SQL-version documents. But we will probably not fix this, since this test will likely be phased out after the migration is complete. A new migrated test will need to insert in SQL-version documents.
  • Why didn't the other SearchInstructorActionTest and SearchStudentActionTest fail? Because the SQL-version of InstructorSearchManager and StudentSearchManager search using email and institute, which is the same as their Datastore counterparts.

@jasonqiu212 jasonqiu212 marked this pull request as ready for review March 6, 2025 11:17
@jasonqiu212
Copy link
Contributor Author

Now it's failing E2E tests..

@jasonqiu212 jasonqiu212 marked this pull request as draft March 6, 2025 11:47
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.

Failing component test
1 participant