Skip to content

FI-3604 Run evaluate without test kit using tmp dir #674

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

Shaumik-Ashraf
Copy link
Contributor

@Shaumik-Ashraf Shaumik-Ashraf commented Apr 24, 2025

Summary

Run inferno execute without being in a test kit by automatically spinning up the required services and putting Docker mounts in a temporary directory. After a release with this PR a user should be able to do:

inferno evaluate ./path/to/package.tgz

Testing Guidance

  1. Checkout this branch
  2. Run the evaluator in a "test kit" (with services)
bundle
bundle exec inferno services start
bundle exec ./bin/inferno evaluate ./spec/fixtures/uscore311.tgz
bundle exec inferno services stop
  1. Make a temporary directory with a Gemfile of inferno core pointing to this branch to run the evaluator outside of a test kit:

Example Gemfile

# frozen_string_literal: true

source "https://rubygems.org"

gem "inferno_core", "~> 0.6.9", github: 'https://github.com/inferno-framework/inferno-core', branch: 'fi-3604-evaluator-tmp-dir'

Example command:

bundle exec inferno evaluate path/to/spec/fixtures/uscore311.tgz

Copy link

codecov bot commented Apr 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.00%. Comparing base (726496f) to head (2fafd6c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #674   +/-   ##
=======================================
  Coverage   85.00%   85.00%           
=======================================
  Files         303      303           
  Lines       13677    13677           
  Branches     1760     1760           
=======================================
  Hits        11626    11626           
  Misses       2043     2043           
  Partials        8        8           
Flag Coverage Δ
backend 91.57% <ø> (ø)
frontend 79.87% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Shaumik-Ashraf Shaumik-Ashraf self-assigned this Apr 24, 2025
@Shaumik-Ashraf Shaumik-Ashraf marked this pull request as ready for review May 1, 2025 19:12
@Shaumik-Ashraf Shaumik-Ashraf changed the title Draft: FI-3604 Run evaluate without test kit using tmp dir FI-3604 Run evaluate without test kit using tmp dir May 1, 2025
@dehall
Copy link
Contributor

dehall commented May 2, 2025

Is it possible to run inferno "globally" without needing a gemfile in the current directory?

@Jammjammjamm
Copy link
Collaborator

Is it possible to run inferno "globally" without needing a gemfile in the current directory?

The Gemfile is only needed for this PR, because you have to point at this branch rather than a released gem.


Dir.chdir(tmpdir) do
Migration.new.run(Logger::FATAL) # Hide migration output for evaluator
evaluate(ig_path, data_path, options)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Won't data_path need to be updated to an absolute path prior to changing the working directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

return @service_names if @service_names

fhirpath_health = Faraday.get("#{ENV.fetch('FHIRPATH_URL', nil)}/version").status
@service_names = "hl7_validator_service #{fhirpath_health == 200 ? '' : 'fhirpath'}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this logic only needed for the fhirpath service? I would expect it to be present for the validator service as well, or just a plain docker compose up without the service names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The validator service doesn't expose its port so it doesn't conflict with spinning it up for the evaluator. On the other hand if we wanted the evaluator to leverage an already running validator service we would have to route it through Nginx or modify test kits to expose the validator port as well.

@@ -9,7 +9,7 @@

Sequel::Model.plugin :json_serializer

config_path = File.expand_path('database.yml', File.join(Dir.pwd, 'config'))
config_path = File.expand_path('../../../../config/database.yml', __dir__)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change prevents users from customizing the database configuration, which is a necessary feature. Also, the config directory is not included in the inferno_core gem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted this line and added a new database config specifically for the evaluator that uses sqlite in memory.

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.

3 participants