-
Notifications
You must be signed in to change notification settings - Fork 5
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
FI-3259: Include presets in gems #572
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #572 +/- ##
=======================================
Coverage 84.17% 84.17%
=======================================
Files 271 271
Lines 11581 11589 +8
Branches 1277 1279 +2
=======================================
+ Hits 9748 9755 +7
- Misses 1823 1824 +1
Partials 10 10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followed testing guidance and confirmed presets loading in from test kit gem.
end | ||
|
||
if Application['base_url'].start_with? 'https://inferno-qa.healthit.gov' | ||
raw_contents.gsub!('https://inferno.healthit.gov', 'https://inferno-qa.healthit.gov') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this opens the gateway to a lot of if Application['base_url'] ...
statements. Inferno really needs some environment-based config built into the framework, but we already require .env
files in test kits, so we can't use dotenv files to prepopulate a bunch of host-specific ENV[...]
settings.
That's honestly an issue for another ticket though. Maybe test kit writers can be really good at putting all their environment-specific test kit things into a preset, and then we'll support something like ENV['INFERNO_ALLOWED_PRESETS'] = "preset_id1,preset_id2"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this opens the gateway to a lot of if Application['base_url'] ... statements.
I don't know that I agree. This is to address a specific issue with presets.
- Locally, you generally want the preset to point to prod. So test kits hard code presets pointing at
inferno.healthit.gov
, i.e. something different thanINFERNO_HOST
. - On prod, you want them to point to
inferno.healthit.gov
, i.e. the same thing asINFERNO_HOST
- On QA, you want them to point to
inferno-qa.healthit.gov
, i.e. the same thing asINFERNO_HOST
Right now I handle this by altering all of the presets in the deployment repo so that they use erb to dynamically determine the correct host. We could add another environment variable in order to make things work correctly locally, in prod, and in QA, but that would require all of the presets that point to the reference server to be rewritten in every test kit. Or we could do this and let all of the existing presets work as they are everywhere, and let people continue to create them in a very straightforward way.
Inferno really needs some environment-based config built into the framework, but we already require .env files in test kits, so we can't use dotenv files to prepopulate a bunch of host-specific ENV[...] settings.
I'm not sure what you mean here. That is exactly what the .env
files are for. But telling test authors that instead of just pointing their presets to https://inferno.healthit.gov/reference-server/r4
, they need to turn their preset into an erb file and point things to <%= ENV.fetch('INFERNO_REFERENCE_SERVER_HOST') %>/reference-server/r4
or whatever is not great, and is the sort of thing people would mess up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this works for our purposes. I'm just thinking from the perspective of a generic framework. If someone wants to deploy a test kit to their production site and staging site but use the same preset file, they need to duplicate .env.production
with the core settings we already mandate, add their own custom env variables, and have their ERB preset use those. AFAIK dotenv files aren't composable so it can get ugly to maintain. I realize this is a low-reward aspirational feature though, devs can just offer two presets with clearly labelled titles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding of our design, hardcoding "inferno.healthit.gov" anywhere in Framework violates our design (forming a dependency from core to one platform's public hosting locations). I believe hardcoding "inferno.healthit.gov" in Test Kit presets violates our design too (forming a dependency from a test kit and one possible platform, though not quite as bad). Whether its worth the effort to decouple these for this type of thing... seems like Steve is saying 'no'.
@Jammjammjamm Did you consider putting this logic into inferno-deployment
, so core doesn't have to know anything about those domains? As long as you considered that and decided it wasn't worth it, then I'm ok with this approach all things considered.
ab9d85b
to
39168ba
Compare
Summary
This branch updates the template to include presets in gems, and updates inferno to automatically load presets from gems. It also replaces any instances of
https://inferno.healthit.gov
withhttps://inferno-qa.healthit.gov
when running on QA.In order for the presets to be automatically loaded from gems, their gemspecs will have to be updated to include the preset files, as well as to set
spec.metadata['inferno_test_kit'] = 'true'
, as shown in the template updates.Testing Guidance
Add the following to the
Gemfile
:Then follow the remaining instructions for running g10 from core in the
Gemfile
.If you
bundle exec inferno start
and select the g10 suite, you will see the preset.You can use the console to verify that the presets are altered when running on QA.