ctti-clinicaltrials / aact

Improving Public Access to Aggregate Content of ClinicalTrials.gov
http://aact.ctti-clinicaltrials.org
MIT License
124 stars 33 forks source link

AACT-548: Make the BackgroundJob tests pass #1079

Closed Javier-Jimenez-18 closed 10 months ago

Javier-Jimenez-18 commented 10 months ago

Fixed the following two FAILs when running the RSpec tests using the GitHub workflow file build-and-test-not-master.yml:

rspec ./spec/models/background_job/db_query_spec.rb:9 # BackgroundJob::DbQuery#process should complete successfully when there is a valid SQL query

rspec ./spec/models/background_job/db_query_spec.rb:17 # BackgroundJob::DbQuery#process should update the status to "error" for the user when the SQL query is invalid

Including these 2 BackgroundJob failures, there is a total of 85 failures:

Screen Shot 2023-08-29 at 11 34 30 AM Screen Shot 2023-08-29 at 11 00 09 AM

I de-bugged the code by adding print statements to find what caused the errors:

Screen Shot 2023-08-18 at 3 43 51 PM Screen Shot 2023-08-29 at 10 54 56 AM

I modified the GitHub workflow file to add a temporary directory and file to store the output csv when the BackgroundJob::DbQuery#process method is called:

Screen Shot 2023-08-29 at 11 30 05 AM

The two tests PASS. Now, there is a total of 83 non-BackgroundJob failures:

Screen Shot 2023-08-29 at 11 28 20 AM Screen Shot 2023-08-29 at 11 33 16 AM
Javier-Jimenez-18 commented 10 months ago

Removed creating a temporary "tmp" directory in the GitHub workflow file build-and-test-not-master.yml .

Added code to create a temporary "tmp" directory in the BackgroundJob::DbQuery#process method.

The 2 RSpec background_job tests still PASS:

Screen Shot 2023-08-30 at 11 05 37 AM