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

I60 config discrepancies destroys development data when running specs #753

Merged
merged 6 commits into from
Aug 16, 2023

Conversation

ShanaLMoore
Copy link
Collaborator

@ShanaLMoore ShanaLMoore commented Aug 12, 2023

In this PR, I compared configurations against working apps like hyku proper and UTK, and took note of the configuration discrepancies.

In particular, we were trying to find the reason why running specs would destroy our local data. Specs should rely on its test environment and its data should be separate from development. Using RAILS_ENV=test didn't make a difference.

For specs there's helper method called #reset! It runs in a before suite hook. Within that method, ActiveFedora::Cleaner.clean! triggered the issue of destroying development data.

With LaRitas help we discovered the issue was actually because of solr using hydra-development for both environments.

Issue:

EOD TODO:

  • test out changes to confirm that running specs won't cause development data to be destroyed

ref: scientist-softserv#60 (comment)

  1. Assuming you have no data, create data in rails console 3.times {Asset.create!}
  2. Verify count Asset.count => 3
  3. Run the following spec
DEPENDENCIES_TEST=1 bundle exec rspec spec/features/update_admin_data_spec.rb 
  1. reload! ; Asset.count => hopefully returns the correct count (ie: 3 in this example)

UPDATE: Tested ✅

image

In this screenshot, i created 3 assets in rails console. then in the spec context i ran the offensive line that previously deleted development data, reloaded rails c and asked for the count again. Previously it would return 0 but it appears to be persisting now.

Previously the solr url for test and development would point to the same place. When ActiveFedora::Clean! got called to reset test data, it would also reset development data. This update should correct that.

Issue
- scientist-softserv#60 (comment)
@ShanaLMoore ShanaLMoore changed the title I60 specs destroy local data bug I60 config discrepancies destroys development data when running specs Aug 12, 2023
@ShanaLMoore
Copy link
Collaborator Author

ShanaLMoore commented Aug 12, 2023

@orangewolf @aprilrieger I would appreciate a review of this, from a devops perspective. I'm not confident about or totally familiar with the consequences of my changes besides the fact that its no longer destroying my development data when I run a spec 🎉

Also, something weird is still happening. I am able to connect to hyku.test even though it's not listed in the docker-compose file and i should only be using ams.test. This was also the reason why we weren't able to run feature specs locally.

@ShanaLMoore ShanaLMoore marked this pull request as ready for review August 12, 2023 02:23
@ShanaLMoore
Copy link
Collaborator Author

Switching to Draft. It's ready for review but I don't want anyone to accidentally merge it until devops review.

@ShanaLMoore ShanaLMoore marked this pull request as draft August 14, 2023 19:57
.solr_wrapper Outdated Show resolved Hide resolved
config/solr_wrapper_test.yml Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
.solr_wrapper Outdated Show resolved Hide resolved
config/fedora.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@orangewolf orangewolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove stuff unrelated to this fix. the fix looks great though.

@ShanaLMoore ShanaLMoore marked this pull request as ready for review August 15, 2023 22:36
@orangewolf orangewolf merged commit 2b888a1 into develop Aug 16, 2023
6 checks passed
@orangewolf orangewolf deleted the i60-specs-destroy-local-data-bug branch August 16, 2023 17:56
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.

2 participants