eAPD icon indicating copy to clipboard operation
eAPD copied to clipboard

[Maintenance] Speed up running unit tests in the api

Open thetif opened this issue 2 years ago • 0 comments

Description and related issues

When we changed the unit tests to hit the actual database instead of using mocks, we piggybacked off of the endpoint docker compose set up. However, whenever we need to run these tests, we have to build the endpoint, which gets destroyed after the run, and it takes a while for the whole process to run. It would probably be more efficient to test again a test database in the dev mongo/postgres databases.

This task is done when…

  • [ ] the unit-test script has been updated to start up the dev docker compose
  • [ ] the unit-test script tears down and rebuilds the hitech_apd_test database in dev postgres
  • [ ] the unit-test script tears down and rebuilds the eapd-test database in the dev mongo
  • [ ] the unit-test script runs migrate and seed on these databases
  • [ ] the unit-test script runs the unit tests against these database
  • [ ] the unit-test script copies out the coverage files in CI/CD (I suggest taking in a command line arg and branching)
  • [ ] the unit-test script does not tear down the containers after it runs in dev
  • [ ] the unit-test script does tear down the containers in CI/CD
  • [ ] all configurations for unit tests have been updated to facilitate changes needed for unit-test script to run
  • [ ] running the unit-test script builds the dev docker compose if the environment isn't running
  • [ ] running the unit-test script uses the existing dev environment if it is running
  • [ ] running the unit-test script resets the databases and seeds all of the correct test data
  • [ ] unit testing passes in CI/CD and uploads the coverage to codecov

thetif avatar Dec 07 '22 23:12 thetif