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

Optimize test_loader to call sync_original_files once per test class #1063

Open
avrohomgottlieb opened this issue Jan 24, 2025 · 0 comments
Open

Comments

@avrohomgottlieb
Copy link
Contributor

Context

Since PR #1060 there is a need for the OriginalFile table to be populated for all testing modules which create projects, samples and libraries. Currently, these modules are test_loader and test_create_portal_metadata.

In the above mentioned PR, there was an attempt to run the sync_original_files command at the beginning of each test suite, calling this command either in the setUpClass or setUpTestData methods. This did not work because the unittest test class that we inherit from is TransactionTestCase, which truncates tables at the end of each test.

We are not able to use TestCase, which rolls back transactions from a specific test to the state of the db before the test ran, because it does not support multithreaded connections to a test DB, which we need for our current local implementation of computed file generation. TransactionTestCase does support multiple concurrent connections to the test db, which is why it was chosen for these test classes in the first place.

Currently we're calling sync_original_files in the setUp function, which runs at the beginning of each individual test, which is ultimately wasteful. We'd like to find a way to both call sync_original_files once while also supporting multithreaded db connections.

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

No branches or pull requests

1 participant