inferno_core 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/inferno/apps/cli/execute_script.rb +918 -0
- data/lib/inferno/apps/cli/main.rb +46 -0
- data/lib/inferno/apps/cli/session/cancel_run.rb +47 -0
- data/lib/inferno/apps/cli/session/connection.rb +47 -0
- data/lib/inferno/apps/cli/session/create_session.rb +159 -0
- data/lib/inferno/apps/cli/session/errors.rb +45 -0
- data/lib/inferno/apps/cli/session/session_compare.rb +390 -0
- data/lib/inferno/apps/cli/session/session_data.rb +39 -0
- data/lib/inferno/apps/cli/session/session_details.rb +27 -0
- data/lib/inferno/apps/cli/session/session_results.rb +39 -0
- data/lib/inferno/apps/cli/session/session_status.rb +69 -0
- data/lib/inferno/apps/cli/session/start_run.rb +245 -0
- data/lib/inferno/apps/cli/session_commands.rb +66 -0
- data/lib/inferno/apps/cli/templates/%library_name%.gemspec.tt +1 -1
- data/lib/inferno/apps/cli/templates/.gitignore +4 -0
- data/lib/inferno/apps/cli/templates/README.md.tt +14 -0
- data/lib/inferno/apps/cli/templates/Rakefile.tt +13 -0
- data/lib/inferno/apps/cli/templates/execution_scripts/%library_name%_script.yaml.tt +20 -0
- data/lib/inferno/apps/cli/templates/execution_scripts/%library_name%_script_expected.json.tt +244 -0
- data/lib/inferno/apps/cli/templates/execution_scripts/README.md.tt +16 -0
- data/lib/inferno/apps/web/serializers/test_group.rb +1 -0
- data/lib/inferno/dsl/fhir_resource_navigation.rb +145 -27
- data/lib/inferno/dsl/must_support_assessment.rb +93 -23
- data/lib/inferno/dsl/must_support_metadata_extractor.rb +139 -21
- data/lib/inferno/dsl/resume_test_route.rb +4 -3
- data/lib/inferno/exceptions.rb +6 -0
- data/lib/inferno/public/bundle.js +9 -9
- data/lib/inferno/repositories/test_sessions.rb +3 -0
- data/lib/inferno/utils/execution_script_runner.rb +90 -0
- data/lib/inferno/utils/preset_processor.rb +2 -0
- data/lib/inferno/version.rb +1 -1
- metadata +18 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'base62-rb'
|
|
2
2
|
require_relative 'repository'
|
|
3
3
|
require_relative '../utils/preset_processor'
|
|
4
|
+
require_relative '../exceptions'
|
|
4
5
|
|
|
5
6
|
module Inferno
|
|
6
7
|
module Repositories
|
|
@@ -46,6 +47,8 @@ module Inferno
|
|
|
46
47
|
|
|
47
48
|
def apply_preset(test_session, preset_id)
|
|
48
49
|
preset = presets_repo.find(preset_id)
|
|
50
|
+
raise Exceptions::UnknownPreset.new(preset_id, test_session.test_suite_id) unless preset.present?
|
|
51
|
+
|
|
49
52
|
Utils::PresetProcessor.new(preset, test_session).processed_inputs.each do |input|
|
|
50
53
|
session_data_repo.save(input.merge(test_session_id: test_session.id))
|
|
51
54
|
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require 'open3'
|
|
2
|
+
|
|
3
|
+
module Inferno
|
|
4
|
+
module Utils
|
|
5
|
+
module ExecutionScriptRunner
|
|
6
|
+
def self.run_all(pattern: 'execution_scripts/**/*.yaml', inferno_base_url: nil, allow_known_errors: false)
|
|
7
|
+
scripts = Dir.glob(pattern)
|
|
8
|
+
|
|
9
|
+
if scripts.empty?
|
|
10
|
+
warn "No scripts found matching: #{pattern}"
|
|
11
|
+
exit 1
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
puts "Found #{scripts.length} script(s) to run.\n\n"
|
|
15
|
+
|
|
16
|
+
passed = []
|
|
17
|
+
failed = []
|
|
18
|
+
|
|
19
|
+
scripts.each do |config|
|
|
20
|
+
unless config.end_with?('.yaml', '.yml')
|
|
21
|
+
warn "Skipping non-YAML file: #{config}"
|
|
22
|
+
next
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
result = run_script(config, inferno_base_url:, allow_known_errors:)
|
|
26
|
+
(result == :pass ? passed : failed) << config
|
|
27
|
+
|
|
28
|
+
puts
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
print_summary(passed, failed)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.run_script(config, inferno_base_url:, allow_known_errors:)
|
|
35
|
+
puts '=' * 60
|
|
36
|
+
puts "Running: #{config}"
|
|
37
|
+
puts '=' * 60
|
|
38
|
+
|
|
39
|
+
allow_commands = File.basename(config, '.yaml').include?('_with_commands')
|
|
40
|
+
cmd = ['bundle', 'exec', 'inferno', 'execute_script', config]
|
|
41
|
+
cmd += ['--inferno-base-url', inferno_base_url] if inferno_base_url
|
|
42
|
+
cmd += ['--allow-commands'] if allow_commands
|
|
43
|
+
output, status = Open3.capture2e(*cmd)
|
|
44
|
+
puts output
|
|
45
|
+
|
|
46
|
+
determine_result(config, status.exitstatus, output, allow_known_errors)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.determine_result(config, return_code, output, allow_known_errors)
|
|
50
|
+
known_error = allow_known_errors && File.basename(config, '.yaml').end_with?('_error')
|
|
51
|
+
return determine_known_error_result(config, output) if known_error && !return_code.zero?
|
|
52
|
+
return (:pass.tap { puts '=> PASS' }) if return_code.zero?
|
|
53
|
+
|
|
54
|
+
puts "=> FAIL (exit code #{return_code})"
|
|
55
|
+
:fail
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.determine_known_error_result(config, output)
|
|
59
|
+
expected_file = File.join(File.dirname(config), "#{File.basename(config, '.yaml')}_expected.json")
|
|
60
|
+
if (output.include?('"errors"') || output.include?('skipping comparison')) && !File.exist?(expected_file)
|
|
61
|
+
puts '=> PASS (known-error script exited with 3 due to expected error before comparison)'
|
|
62
|
+
:pass
|
|
63
|
+
elsif output.include?('Actual results matched expected results? true')
|
|
64
|
+
puts '=> PASS (known-error script exited with 3 and results matched expected)'
|
|
65
|
+
:pass
|
|
66
|
+
else
|
|
67
|
+
puts '=> FAIL (exited with 3 but results did not match expected)'
|
|
68
|
+
:fail
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def self.print_summary(passed, failed)
|
|
73
|
+
puts '=' * 60
|
|
74
|
+
puts "Results: #{passed.length} passed, #{failed.length} failed"
|
|
75
|
+
puts '=' * 60
|
|
76
|
+
|
|
77
|
+
if passed.any?
|
|
78
|
+
puts 'Passed:'
|
|
79
|
+
passed.each { |s| puts " #{s}" }
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
return unless failed.any?
|
|
83
|
+
|
|
84
|
+
puts 'Failed:'
|
|
85
|
+
failed.each { |s| puts " #{s}" }
|
|
86
|
+
exit 1
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
data/lib/inferno/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inferno_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stephen MacVicar
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2026-
|
|
13
|
+
date: 2026-04-17 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activesupport
|
|
@@ -483,6 +483,7 @@ files:
|
|
|
483
483
|
- lib/inferno/apps/cli/execute/plain_outputter.rb
|
|
484
484
|
- lib/inferno/apps/cli/execute/quiet_outputter.rb
|
|
485
485
|
- lib/inferno/apps/cli/execute/serialize.rb
|
|
486
|
+
- lib/inferno/apps/cli/execute_script.rb
|
|
486
487
|
- lib/inferno/apps/cli/main.rb
|
|
487
488
|
- lib/inferno/apps/cli/migration.rb
|
|
488
489
|
- lib/inferno/apps/cli/new.rb
|
|
@@ -490,6 +491,17 @@ files:
|
|
|
490
491
|
- lib/inferno/apps/cli/requirements_coverage_checker.rb
|
|
491
492
|
- lib/inferno/apps/cli/requirements_exporter.rb
|
|
492
493
|
- lib/inferno/apps/cli/services.rb
|
|
494
|
+
- lib/inferno/apps/cli/session/cancel_run.rb
|
|
495
|
+
- lib/inferno/apps/cli/session/connection.rb
|
|
496
|
+
- lib/inferno/apps/cli/session/create_session.rb
|
|
497
|
+
- lib/inferno/apps/cli/session/errors.rb
|
|
498
|
+
- lib/inferno/apps/cli/session/session_compare.rb
|
|
499
|
+
- lib/inferno/apps/cli/session/session_data.rb
|
|
500
|
+
- lib/inferno/apps/cli/session/session_details.rb
|
|
501
|
+
- lib/inferno/apps/cli/session/session_results.rb
|
|
502
|
+
- lib/inferno/apps/cli/session/session_status.rb
|
|
503
|
+
- lib/inferno/apps/cli/session/start_run.rb
|
|
504
|
+
- lib/inferno/apps/cli/session_commands.rb
|
|
493
505
|
- lib/inferno/apps/cli/suite.rb
|
|
494
506
|
- lib/inferno/apps/cli/suite_input_template.rb
|
|
495
507
|
- lib/inferno/apps/cli/suites.rb
|
|
@@ -524,6 +536,9 @@ files:
|
|
|
524
536
|
- lib/inferno/apps/cli/templates/docs/README.md.tt
|
|
525
537
|
- lib/inferno/apps/cli/templates/docs/_Footer.md
|
|
526
538
|
- lib/inferno/apps/cli/templates/docs/_Sidebar.md
|
|
539
|
+
- lib/inferno/apps/cli/templates/execution_scripts/%library_name%_script.yaml.tt
|
|
540
|
+
- lib/inferno/apps/cli/templates/execution_scripts/%library_name%_script_expected.json.tt
|
|
541
|
+
- lib/inferno/apps/cli/templates/execution_scripts/README.md.tt
|
|
527
542
|
- lib/inferno/apps/cli/templates/lib/%library_name%.rb.tt
|
|
528
543
|
- lib/inferno/apps/cli/templates/lib/%library_name%/example_suite.rb.tt
|
|
529
544
|
- lib/inferno/apps/cli/templates/lib/%library_name%/example_suite/patient_group.rb.tt
|
|
@@ -724,6 +739,7 @@ files:
|
|
|
724
739
|
- lib/inferno/route_storage.rb
|
|
725
740
|
- lib/inferno/spec_support.rb
|
|
726
741
|
- lib/inferno/test_runner.rb
|
|
742
|
+
- lib/inferno/utils/execution_script_runner.rb
|
|
727
743
|
- lib/inferno/utils/ig_downloader.rb
|
|
728
744
|
- lib/inferno/utils/markdown_formatter.rb
|
|
729
745
|
- lib/inferno/utils/middleware/request_logger.rb
|