inferno_core 0.3.11 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/inferno/apps/cli/main.rb +13 -0
  3. data/lib/inferno/apps/cli/services.rb +56 -0
  4. data/lib/inferno/apps/web/application.rb +1 -0
  5. data/lib/inferno/apps/web/controllers/controller.rb +6 -8
  6. data/lib/inferno/apps/web/controllers/requests/show.rb +3 -3
  7. data/lib/inferno/apps/web/controllers/test_runs/create.rb +13 -17
  8. data/lib/inferno/apps/web/controllers/test_runs/destroy.rb +8 -10
  9. data/lib/inferno/apps/web/controllers/test_runs/results/index.rb +4 -4
  10. data/lib/inferno/apps/web/controllers/test_runs/show.rb +9 -7
  11. data/lib/inferno/apps/web/controllers/test_sessions/create.rb +9 -8
  12. data/lib/inferno/apps/web/controllers/test_sessions/last_test_run.rb +4 -4
  13. data/lib/inferno/apps/web/controllers/test_sessions/results/index.rb +6 -6
  14. data/lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb +10 -10
  15. data/lib/inferno/apps/web/controllers/test_sessions/session_data/index.rb +5 -3
  16. data/lib/inferno/apps/web/controllers/test_sessions/show.rb +3 -3
  17. data/lib/inferno/apps/web/controllers/test_suites/check_configuration.rb +3 -3
  18. data/lib/inferno/apps/web/controllers/test_suites/index.rb +2 -2
  19. data/lib/inferno/apps/web/controllers/test_suites/show.rb +3 -3
  20. data/lib/inferno/apps/web/index.html.erb +4 -0
  21. data/lib/inferno/apps/web/router.rb +55 -41
  22. data/lib/inferno/apps/web/serializers/message.rb +2 -0
  23. data/lib/inferno/apps/web/serializers/preset.rb +2 -5
  24. data/lib/inferno/apps/web/serializers/request.rb +4 -1
  25. data/lib/inferno/apps/web/serializers/result.rb +5 -1
  26. data/lib/inferno/apps/web/serializers/session_data.rb +2 -0
  27. data/lib/inferno/apps/web/serializers/suite_option.rb +2 -0
  28. data/lib/inferno/apps/web/serializers/test.rb +3 -0
  29. data/lib/inferno/apps/web/serializers/test_group.rb +4 -2
  30. data/lib/inferno/apps/web/serializers/test_run.rb +3 -0
  31. data/lib/inferno/apps/web/serializers/test_suite.rb +5 -1
  32. data/lib/inferno/config/application.rb +1 -6
  33. data/lib/inferno/config/boot/web.rb +2 -7
  34. data/lib/inferno/config/boot.rb +6 -1
  35. data/lib/inferno/dsl/assertions.rb +2 -2
  36. data/lib/inferno/dsl/configurable.rb +4 -4
  37. data/lib/inferno/dsl/fhir_client.rb +3 -2
  38. data/lib/inferno/dsl/fhir_client_builder.rb +2 -2
  39. data/lib/inferno/dsl/fhir_validation.rb +5 -6
  40. data/lib/inferno/dsl/http_client.rb +17 -18
  41. data/lib/inferno/dsl/http_client_builder.rb +4 -4
  42. data/lib/inferno/dsl/input_output_handling.rb +1 -1
  43. data/lib/inferno/dsl/request_storage.rb +2 -2
  44. data/lib/inferno/dsl/resume_test_route.rb +36 -34
  45. data/lib/inferno/dsl/runnable.rb +13 -10
  46. data/lib/inferno/entities/header.rb +7 -7
  47. data/lib/inferno/entities/request.rb +35 -36
  48. data/lib/inferno/entities/session_data.rb +6 -6
  49. data/lib/inferno/entities/test.rb +4 -4
  50. data/lib/inferno/entities/test_group.rb +2 -2
  51. data/lib/inferno/entities/test_run.rb +1 -1
  52. data/lib/inferno/jobs/execute_test_run.rb +1 -1
  53. data/lib/inferno/jobs/resume_test_run.rb +1 -1
  54. data/lib/inferno/public/bundle.js +15 -15
  55. data/lib/inferno/repositories/messages.rb +1 -1
  56. data/lib/inferno/repositories/repository.rb +1 -1
  57. data/lib/inferno/repositories/requests.rb +6 -6
  58. data/lib/inferno/repositories/results.rb +16 -16
  59. data/lib/inferno/repositories/session_data.rb +6 -6
  60. data/lib/inferno/repositories/test_runs.rb +6 -6
  61. data/lib/inferno/repositories/test_sessions.rb +7 -7
  62. data/lib/inferno/test_runner.rb +3 -3
  63. data/lib/inferno/utils/preset_template_generator.rb +1 -1
  64. data/lib/inferno/version.rb +1 -1
  65. data/spec/factories/test_run.rb +1 -1
  66. data/spec/factories/test_session.rb +1 -1
  67. data/spec/fixtures/basic_test_suite.rb +1 -0
  68. metadata +25 -24
@@ -4,7 +4,7 @@ module Inferno
4
4
  def messages_for_result(result_id)
5
5
  self.class::Model
6
6
  .order(:index)
7
- .where(result_id: result_id)
7
+ .where(result_id:)
8
8
  .to_a
9
9
  .map!(&:to_json_data)
10
10
  .each(&:deep_symbolize_keys!)
@@ -48,7 +48,7 @@ module Inferno
48
48
  # @return [Inferno::Entities] an instance of the class returned by
49
49
  # `#entity_class`
50
50
  def find(id)
51
- result = self.class::Model.find(id: id)
51
+ result = self.class::Model.find(id:)
52
52
  return result if result.nil?
53
53
 
54
54
  build_entity(result.to_hash)
@@ -1,7 +1,7 @@
1
1
  module Inferno
2
2
  module Repositories
3
3
  class Requests < Repository
4
- include Import[headers_repo: 'repositories.headers']
4
+ include Import[headers_repo: 'inferno.repositories.headers']
5
5
 
6
6
  def create(params)
7
7
  request = self.class::Model.create(db_params(params))
@@ -17,7 +17,7 @@ module Inferno
17
17
 
18
18
  build_entity(
19
19
  request.to_hash
20
- .merge(headers: headers)
20
+ .merge(headers:)
21
21
  .merge(non_db_params(params))
22
22
  )
23
23
  end
@@ -25,7 +25,7 @@ module Inferno
25
25
  def find(id)
26
26
  result =
27
27
  self.class::Model
28
- .where(id: id)
28
+ .where(id:)
29
29
  .select(*entity_class::SUMMARY_FIELDS)
30
30
  .to_a
31
31
  return nil if result.blank?
@@ -36,7 +36,7 @@ module Inferno
36
36
  def find_full_request(id)
37
37
  result =
38
38
  self.class::Model
39
- .find(id: id)
39
+ .find(id:)
40
40
  .to_json_data(json_serializer_options)
41
41
  .deep_symbolize_keys!
42
42
 
@@ -46,7 +46,7 @@ module Inferno
46
46
  def find_named_request(test_session_id, name)
47
47
  results =
48
48
  self.class::Model
49
- .where(test_session_id: test_session_id, name: name.to_s)
49
+ .where(test_session_id:, name: name.to_s)
50
50
  .map { |model| model.to_json_data(json_serializer_options) }
51
51
  return nil if results.blank?
52
52
 
@@ -59,7 +59,7 @@ module Inferno
59
59
  def requests_for_result(result_id)
60
60
  self.class::Model
61
61
  .order(:index)
62
- .where(result_id: result_id)
62
+ .where(result_id:)
63
63
  .select(*entity_class::SUMMARY_FIELDS)
64
64
  .to_a
65
65
  .map(&:to_hash)
@@ -4,11 +4,11 @@ module Inferno
4
4
  module Repositories
5
5
  class Results < Repository
6
6
  include Import[
7
- messages_repo: 'repositories.messages',
8
- requests_repo: 'repositories.requests',
9
- tests_repo: 'repositories.tests',
10
- groups_repo: 'repositories.test_groups',
11
- suites_repo: 'repositories.test_suites'
7
+ messages_repo: 'inferno.repositories.messages',
8
+ requests_repo: 'inferno.repositories.requests',
9
+ tests_repo: 'inferno.repositories.tests',
10
+ groups_repo: 'inferno.repositories.test_groups',
11
+ suites_repo: 'inferno.repositories.test_suites'
12
12
  ]
13
13
 
14
14
  def create(params)
@@ -37,9 +37,9 @@ module Inferno
37
37
  # test_session_id,
38
38
  # test_id: 'test_id'
39
39
  # )
40
- def current_result_for_test_session(test_session_id, **params)
40
+ def current_result_for_test_session(test_session_id, params)
41
41
  self.class::Model
42
- .where({ test_session_id: test_session_id }.merge(params))
42
+ .where({ test_session_id: }.merge(params))
43
43
  .order(Sequel.desc(:updated_at))
44
44
  .limit(1)
45
45
  .all
@@ -66,10 +66,10 @@ module Inferno
66
66
  entity_class.new(params.merge(runnable))
67
67
  end
68
68
 
69
- def result_for_test_run(test_run_id:, **params)
69
+ def result_for_test_run(params)
70
70
  result_hash =
71
71
  self.class::Model
72
- .find({ test_run_id: test_run_id }.merge(params))
72
+ .find(params)
73
73
  &.to_hash
74
74
 
75
75
  return nil if result_hash.nil?
@@ -79,7 +79,7 @@ module Inferno
79
79
 
80
80
  def test_run_results_after(test_run_id:, after:)
81
81
  Model
82
- .where(test_run_id: test_run_id)
82
+ .where(test_run_id:)
83
83
  .where { updated_at >= after }
84
84
  .to_a
85
85
  .map! do |result_hash|
@@ -94,7 +94,7 @@ module Inferno
94
94
  def find_waiting_result(test_run_id:)
95
95
  result_hash =
96
96
  Model
97
- .where(test_run_id: test_run_id, result: 'wait')
97
+ .where(test_run_id:, result: 'wait')
98
98
  .where { test_id !~ nil }
99
99
  .limit(1)
100
100
  .to_a
@@ -202,7 +202,7 @@ module Inferno
202
202
  end
203
203
 
204
204
  def self.current_results_for_test_session(test_session_id)
205
- fetch(current_results_sql, test_session_id: test_session_id)
205
+ fetch(current_results_sql, test_session_id:)
206
206
  end
207
207
 
208
208
  def self.current_results_for_test_session_and_runnables(test_session_id, runnables)
@@ -212,10 +212,10 @@ module Inferno
212
212
 
213
213
  fetch(
214
214
  current_results_sql(with_runnables_filter: true),
215
- test_session_id: test_session_id,
216
- test_ids: test_ids,
217
- test_group_ids: test_group_ids,
218
- test_suite_ids: test_suite_ids
215
+ test_session_id:,
216
+ test_ids:,
217
+ test_group_ids:,
218
+ test_suite_ids:
219
219
  )
220
220
  end
221
221
  end
@@ -10,19 +10,19 @@ module Inferno
10
10
  db
11
11
  .insert_conflict(
12
12
  target: :id,
13
- update: { value: value }
13
+ update: { value: }
14
14
  ).insert(
15
15
  id: "#{test_session_id}_#{name}",
16
- name: name,
17
- value: value,
18
- test_session_id: test_session_id
16
+ name:,
17
+ value:,
18
+ test_session_id:
19
19
  )
20
20
  end
21
21
 
22
22
  def load(test_session_id:, name:, type: 'text')
23
23
  raw_value =
24
24
  self.class::Model
25
- .find(test_session_id: test_session_id, name: name.to_s.downcase)
25
+ .find(test_session_id:, name: name.to_s.downcase)
26
26
  &.value
27
27
 
28
28
  case type.to_s
@@ -35,7 +35,7 @@ module Inferno
35
35
 
36
36
  def get_all_from_session(test_session_id)
37
37
  self.class::Model
38
- .where(test_session_id: test_session_id)
38
+ .where(test_session_id:)
39
39
  .all
40
40
  .map! do |session_data_hash|
41
41
  build_entity(
@@ -3,7 +3,7 @@ require_relative 'validate_runnable_reference'
3
3
  module Inferno
4
4
  module Repositories
5
5
  class TestRuns < Repository
6
- include Import[results_repo: 'repositories.results']
6
+ include Import[results_repo: 'inferno.repositories.results']
7
7
 
8
8
  def json_serializer_options
9
9
  {
@@ -36,7 +36,7 @@ module Inferno
36
36
  test_run_hash =
37
37
  self.class::Model
38
38
  .where(status: 'waiting')
39
- .where(identifier: identifier)
39
+ .where(identifier:)
40
40
  .where { wait_timeout >= Time.now }
41
41
  .order(Sequel.desc(:updated_at))
42
42
  .limit(1)
@@ -52,7 +52,7 @@ module Inferno
52
52
  def last_test_run(test_session_id)
53
53
  test_run_hash =
54
54
  self.class::Model
55
- .where(test_session_id: test_session_id)
55
+ .where(test_session_id:)
56
56
  .order(Sequel.desc(:updated_at))
57
57
  .limit(1)
58
58
  .to_a
@@ -66,7 +66,7 @@ module Inferno
66
66
  end
67
67
 
68
68
  def status_for_test_run(id)
69
- self.class::Model.where(id: id).get(:status)
69
+ self.class::Model.where(id:).get(:status)
70
70
  end
71
71
 
72
72
  def mark_as_running(test_run_id)
@@ -81,7 +81,7 @@ module Inferno
81
81
  update(
82
82
  test_run_id,
83
83
  status: 'waiting',
84
- identifier: identifier,
84
+ identifier:,
85
85
  wait_timeout: Time.now + timeout.seconds
86
86
  )
87
87
  end
@@ -126,7 +126,7 @@ module Inferno
126
126
 
127
127
  def active_test_run_for_session?(test_session_id)
128
128
  self.class::Model
129
- .where(test_session_id: test_session_id)
129
+ .where(test_session_id:)
130
130
  .exclude(status: 'done')
131
131
  .count.positive?
132
132
  end
@@ -5,9 +5,9 @@ module Inferno
5
5
  # Repository that deals with persistence for the `TestSession` entity.
6
6
  class TestSessions < Repository
7
7
  include Import[
8
- results_repo: 'repositories.results',
9
- session_data_repo: 'repositories.session_data',
10
- presets_repo: 'repositories.presets'
8
+ results_repo: 'inferno.repositories.results',
9
+ session_data_repo: 'inferno.repositories.session_data',
10
+ presets_repo: 'inferno.repositories.presets'
11
11
  ]
12
12
 
13
13
  def json_serializer_options
@@ -28,7 +28,7 @@ module Inferno
28
28
  JSON.generate(raw_suite_options.map(&:to_hash))
29
29
  end
30
30
 
31
- super(params.merge(suite_options: suite_options))
31
+ super(params.merge(suite_options:))
32
32
  end
33
33
 
34
34
  def results_for_test_session(test_session_id)
@@ -45,7 +45,7 @@ module Inferno
45
45
  def apply_preset(test_session_id, preset_id)
46
46
  preset = presets_repo.find(preset_id)
47
47
  preset.inputs.each do |input|
48
- session_data_repo.save(input.merge(test_session_id: test_session_id))
48
+ session_data_repo.save(input.merge(test_session_id:))
49
49
  end
50
50
  end
51
51
 
@@ -56,13 +56,13 @@ module Inferno
56
56
  DSL::SuiteOption.new(suite_option_hash)
57
57
  end
58
58
 
59
- final_params = params.merge(suite_options: suite_options)
59
+ final_params = params.merge(suite_options:)
60
60
  add_non_db_entities(final_params)
61
61
  entity_class.new(final_params)
62
62
  end
63
63
 
64
64
  class Model < Sequel::Model(db)
65
- include Import[test_suites_repo: 'repositories.test_suites']
65
+ include Import[test_suites_repo: 'inferno.repositories.test_suites']
66
66
 
67
67
  one_to_many :results,
68
68
  eager: [:messages, :requests],
@@ -64,9 +64,9 @@ module Inferno
64
64
 
65
65
  test_instance =
66
66
  test.new(
67
- inputs: inputs,
67
+ inputs:,
68
68
  test_session_id: test_session.id,
69
- scratch: scratch,
69
+ scratch:,
70
70
  suite_options: test_session.suite_options_hash
71
71
  )
72
72
 
@@ -96,7 +96,7 @@ module Inferno
96
96
  {
97
97
  messages: test_instance.messages,
98
98
  requests: test_instance.requests,
99
- result: result,
99
+ result:,
100
100
  result_message: test_instance.result_message,
101
101
  input_json: input_json_string,
102
102
  output_json: output_json_string
@@ -29,7 +29,7 @@ module Inferno
29
29
 
30
30
  def generate
31
31
  metadata.merge(
32
- inputs: inputs
32
+ inputs:
33
33
  )
34
34
  end
35
35
  end
@@ -1,4 +1,4 @@
1
1
  module Inferno
2
2
  # Standard patterns for gem versions: https://guides.rubygems.org/patterns/
3
- VERSION = '0.3.11'.freeze
3
+ VERSION = '0.4.0'.freeze
4
4
  end
@@ -4,7 +4,7 @@ FactoryBot.define do
4
4
  test_session_id { test_session.id }
5
5
 
6
6
  transient do
7
- runnable { { test_suite_id: 'BasicTestSuite::Suite' } }
7
+ runnable { { test_suite_id: 'basic' } }
8
8
  end
9
9
 
10
10
  test_suite_id { runnable[:test_suite_id] }
@@ -2,7 +2,7 @@ require_relative '../../lib/inferno/repositories'
2
2
 
3
3
  FactoryBot.define do
4
4
  factory :test_session, class: 'Inferno::Entities::TestSession' do
5
- test_suite_id { 'BasicTestSuite::Suite' }
5
+ test_suite_id { 'basic' }
6
6
 
7
7
  initialize_with { new(**attributes) }
8
8
 
@@ -4,5 +4,6 @@ module BasicTestSuite
4
4
  class Suite < Inferno::Entities::TestSuite
5
5
  title 'Basic Test Suite'
6
6
  group from: 'BasicTestSuite::AbcGroup'
7
+ id :basic
7
8
  end
8
9
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inferno_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
8
8
  - Robert Scanlon
9
9
  - Chase Zhou
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-09-13 00:00:00.000000000 Z
13
+ date: 2022-10-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -60,42 +60,42 @@ dependencies:
60
60
  requirements:
61
61
  - - '='
62
62
  - !ruby/object:Gem::Version
63
- version: 0.12.0
63
+ version: 0.13.0
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - '='
69
69
  - !ruby/object:Gem::Version
70
- version: 0.12.0
70
+ version: 0.13.0
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: dry-container
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - '='
76
76
  - !ruby/object:Gem::Version
77
- version: 0.8.0
77
+ version: 0.9.0
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - '='
83
83
  - !ruby/object:Gem::Version
84
- version: 0.8.0
84
+ version: 0.9.0
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: dry-system
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.18.1
91
+ version: 0.20.0
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - '='
97
97
  - !ruby/object:Gem::Version
98
- version: 0.18.1
98
+ version: 0.20.0
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: faraday
101
101
  requirement: !ruby/object:Gem::Requirement
@@ -156,30 +156,30 @@ dependencies:
156
156
  name: hanami-controller
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - "~>"
159
+ - - '='
160
160
  - !ruby/object:Gem::Version
161
- version: '1.3'
161
+ version: 2.0.0.beta1
162
162
  type: :runtime
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
- - - "~>"
166
+ - - '='
167
167
  - !ruby/object:Gem::Version
168
- version: '1.3'
168
+ version: 2.0.0.beta1
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: hanami-router
171
171
  requirement: !ruby/object:Gem::Requirement
172
172
  requirements:
173
- - - "~>"
173
+ - - '='
174
174
  - !ruby/object:Gem::Version
175
- version: '1.3'
175
+ version: 2.0.0.beta2
176
176
  type: :runtime
177
177
  prerelease: false
178
178
  version_requirements: !ruby/object:Gem::Requirement
179
179
  requirements:
180
- - - "~>"
180
+ - - '='
181
181
  - !ruby/object:Gem::Version
182
- version: '1.3'
182
+ version: 2.0.0.beta2
183
183
  - !ruby/object:Gem::Dependency
184
184
  name: oj
185
185
  requirement: !ruby/object:Gem::Requirement
@@ -298,14 +298,14 @@ dependencies:
298
298
  requirements:
299
299
  - - "~>"
300
300
  - !ruby/object:Gem::Version
301
- version: 1.1.0
301
+ version: 1.2.1
302
302
  type: :runtime
303
303
  prerelease: false
304
304
  version_requirements: !ruby/object:Gem::Requirement
305
305
  requirements:
306
306
  - - "~>"
307
307
  - !ruby/object:Gem::Version
308
- version: 1.1.0
308
+ version: 1.2.1
309
309
  - !ruby/object:Gem::Dependency
310
310
  name: codecov
311
311
  requirement: !ruby/object:Gem::Requirement
@@ -490,6 +490,7 @@ files:
490
490
  - lib/inferno/apps/cli/console.rb
491
491
  - lib/inferno/apps/cli/main.rb
492
492
  - lib/inferno/apps/cli/migration.rb
493
+ - lib/inferno/apps/cli/services.rb
493
494
  - lib/inferno/apps/cli/suite.rb
494
495
  - lib/inferno/apps/cli/suite_input_template.rb
495
496
  - lib/inferno/apps/cli/suites.rb
@@ -628,24 +629,24 @@ metadata:
628
629
  homepage_uri: https://github.com/inferno-framework/inferno-core
629
630
  source_code_uri: https://github.com/inferno-framework/inferno-core
630
631
  changelog_uri: https://github.com/inferno-framework/inferno-core/blob/main/CHANGELOG.md
631
- post_install_message:
632
+ post_install_message:
632
633
  rdoc_options: []
633
634
  require_paths:
634
635
  - lib
635
636
  - spec
636
637
  required_ruby_version: !ruby/object:Gem::Requirement
637
638
  requirements:
638
- - - ">="
639
+ - - "~>"
639
640
  - !ruby/object:Gem::Version
640
- version: 2.7.0
641
+ version: 3.1.2
641
642
  required_rubygems_version: !ruby/object:Gem::Requirement
642
643
  requirements:
643
644
  - - ">="
644
645
  - !ruby/object:Gem::Version
645
646
  version: '0'
646
647
  requirements: []
647
- rubygems_version: 3.1.6
648
- signing_key:
648
+ rubygems_version: 3.3.7
649
+ signing_key:
649
650
  specification_version: 4
650
651
  summary: Inferno Core is an open source tool for testing data exchanges enabled by
651
652
  the FHIR standand