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

Don't just mount spec folder, but complete app folder for tests #648

Merged
merged 3 commits into from
Jun 1, 2024

Conversation

Splines
Copy link
Member

@Splines Splines commented May 31, 2024

This is to ensure that local changes in the app folder are reflected in the Docker container such that newly written tests can be run through without having to rebuild the whole Docker image.

  • While the whole app folder is mounted to /usr/src/app/app, wee construct a specific public volume such that the rake assets:precompile task can populate the folder usr/src/app/public/packs-test/.

  • Note that all files are still copied in the Dockerfile such that rails assets:precompile can work correctly. The app/ folder is then later mounted "on top" of that.

  • Also moved the entrypoint declaration to the place where it's declared in the development setup, just to achieve symmetry.

For reviewers

Please delete your old mampf test image (if you have one locally) before testing the changes made in this PR.

A good way to test the changes in this PR could be as follows:

  • git fetch
  • git switch feature/user-cleaner
  • git merge tests/mount-app-folder (only for your local playground, so please don't push)
  • Check if tests run through locally. Everything should work fine.
  • Rename app/models/user_cleaner.rb to user_cleaner_changed.rb (also the class name). Adjust accordingly in user_cleaner_spec.rb. Then, run the tests again. Everything should still work fine. With this procedure, you've checked that the locally changed file content (user_cleaner_changed.rb) is available in the Docker container. If it wasn't, you would get an error saying that there was no class called UserCleanerChanged.
  • After this, reset your local git merge: git reset --hard origin/feature/user-cleaner. Note this will hard-reset any modified changes! Instead, you could also do git reset HEAD~1 to keep your modifications (and those by the initial git merge you made).

This is to ensure that local changes in the `app` folder are reflected
in the Docker container such that newly written tests can be run through
without having to rebuild the whole Docker image.
@Splines Splines added the tests Unit tests, integration tests etc. label May 31, 2024
@Splines Splines self-assigned this May 31, 2024
@Splines Splines marked this pull request as draft May 31, 2024 17:40
Copy link

codecov bot commented Jun 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.63%. Comparing base (4ead9d5) to head (5ec9818).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #648   +/-   ##
=======================================
  Coverage   66.63%   66.63%           
=======================================
  Files         309      309           
  Lines        9384     9384           
=======================================
  Hits         6253     6253           
  Misses       3131     3131           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Splines Splines marked this pull request as ready for review June 1, 2024 02:59
@Splines Splines requested a review from fosterfarrell9 June 1, 2024 03:00
@Splines Splines merged commit 0c841de into dev Jun 1, 2024
9 checks passed
@Splines Splines deleted the tests/mount-app-folder branch June 1, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Unit tests, integration tests etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants