inferno_core 0.0.7 → 0.1.0.pre

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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/inferno/apps/web/controllers/test_runs/create.rb +2 -1
  3. data/lib/inferno/apps/web/index.html.erb +1 -0
  4. data/lib/inferno/db/migrations/001_create_initial_structure.rb +54 -53
  5. data/lib/inferno/db/migrations/002_add_wait_support.rb +2 -2
  6. data/lib/inferno/db/migrations/003_update_session_data.rb +7 -7
  7. data/lib/inferno/db/migrations/004_add_request_results_table.rb +2 -2
  8. data/lib/inferno/db/migrations/005_add_updated_at_index_to_results.rb +1 -1
  9. data/lib/inferno/db/migrations/006_remove_unused_tables.rb +38 -0
  10. data/lib/inferno/db/schema.rb +16 -42
  11. data/lib/inferno/dsl/configurable.rb +12 -5
  12. data/lib/inferno/dsl/fhir_client.rb +62 -20
  13. data/lib/inferno/dsl/fhir_client_builder.rb +16 -0
  14. data/lib/inferno/dsl/fhir_validation.rb +104 -0
  15. data/lib/inferno/dsl/oauth_credentials.rb +119 -0
  16. data/lib/inferno/dsl/runnable.rb +20 -8
  17. data/lib/inferno/entities/request.rb +7 -1
  18. data/lib/inferno/exceptions.rb +19 -0
  19. data/lib/inferno/ext/fhir_client.rb +13 -0
  20. data/lib/inferno/public/217.bundle.js +1 -1
  21. data/lib/inferno/public/bundle.js +154 -1
  22. data/lib/inferno/public/bundle.js.LICENSE.txt +15 -0
  23. data/lib/inferno/repositories/session_data.rb +40 -6
  24. data/lib/inferno/spec_support.rb +1 -1
  25. data/lib/inferno/test_runner.rb +8 -3
  26. data/lib/inferno/utils/middleware/request_logger.rb +8 -2
  27. data/lib/inferno/version.rb +1 -1
  28. data/spec/factories/request.rb +1 -1
  29. data/spec/factories/result.rb +2 -2
  30. data/spec/fixtures/basic_test_group.rb +1 -0
  31. metadata +11 -8
@@ -19,6 +19,12 @@ object-assign
19
19
  * @license MIT
20
20
  */
21
21
 
22
+ /** @license MUI v5.2.0
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */
27
+
22
28
  /** @license React v0.20.2
23
29
  * scheduler.production.min.js
24
30
  *
@@ -55,6 +61,15 @@ object-assign
55
61
  * LICENSE file in the root directory of this source tree.
56
62
  */
57
63
 
64
+ /** @license React v17.0.2
65
+ * react-jsx-runtime.production.min.js
66
+ *
67
+ * Copyright (c) Facebook, Inc. and its affiliates.
68
+ *
69
+ * This source code is licensed under the MIT license found in the
70
+ * LICENSE file in the root directory of this source tree.
71
+ */
72
+
58
73
  /** @license React v17.0.2
59
74
  * react.production.min.js
60
75
  *
@@ -4,22 +4,33 @@ module Inferno
4
4
  def save(params)
5
5
  name = params[:name].to_s.downcase
6
6
  test_session_id = params[:test_session_id]
7
+
8
+ value = value_to_persist(params)
9
+
7
10
  db
8
11
  .insert_conflict(
9
12
  target: :id,
10
- update: { value: params[:value] }
13
+ update: { value: value }
11
14
  ).insert(
12
15
  id: "#{test_session_id}_#{name}",
13
16
  name: name,
14
- value: params[:value],
17
+ value: value,
15
18
  test_session_id: test_session_id
16
19
  )
17
20
  end
18
21
 
19
- def load(test_session_id:, name:)
20
- self.class::Model
21
- .find(test_session_id: test_session_id, name: name.to_s.downcase)
22
- &.value
22
+ def load(test_session_id:, name:, type: 'text')
23
+ raw_value =
24
+ self.class::Model
25
+ .find(test_session_id: test_session_id, name: name.to_s.downcase)
26
+ &.value
27
+
28
+ case type.to_s
29
+ when 'oauth_credentials'
30
+ DSL::OAuthCredentials.new(JSON.parse(raw_value))
31
+ else
32
+ raw_value
33
+ end
23
34
  end
24
35
 
25
36
  def get_all_from_session(test_session_id)
@@ -39,6 +50,29 @@ module Inferno
39
50
  'SessionData'
40
51
  end
41
52
 
53
+ def value_to_persist(params)
54
+ return nil if params[:value].blank?
55
+
56
+ case params[:type]&.to_s
57
+ when 'text', 'textarea'
58
+ params[:value].to_s
59
+ when 'oauth_credentials'
60
+ credentials =
61
+ if params[:value].is_a? String
62
+ DSL::OAuthCredentials.new(JSON.parse(params[:value]))
63
+ elsif !params[:value].is_a? DSL::OAuthCredentials
64
+ raise Exceptions::BadSessionDataType.new(params[:name], DSL::OAuthCredentials, params[:value].class)
65
+ else
66
+ params[:value]
67
+ end
68
+
69
+ credentials.name = params[:name]
70
+ credentials.to_s
71
+ else
72
+ raise Exceptions::UnknownSessionDataType, params
73
+ end
74
+ end
75
+
42
76
  class Model < Sequel::Model(db)
43
77
  many_to_one :test_session, class: 'Inferno::Repositories::TestSessions::Model', key: :test_session_id
44
78
  end
@@ -1,5 +1,5 @@
1
1
  module Inferno
2
- # @private
2
+ # @api private
3
3
  # This module provides constants so that unit tests in suite repositories can
4
4
  # load the factories defined in inferno.
5
5
  module SpecSupport
@@ -137,16 +137,21 @@ module Inferno
137
137
  def load_inputs(runnable)
138
138
  runnable.inputs.each_with_object({}) do |input_identifier, input_hash|
139
139
  input_alias = runnable.config.input_name(input_identifier)
140
- input_hash[input_identifier] = session_data_repo.load(test_session_id: test_session.id, name: input_alias)
140
+ input_type = runnable.config.input_type(input_identifier)
141
+ input_hash[input_identifier] =
142
+ session_data_repo.load(test_session_id: test_session.id, name: input_alias, type: input_type)
141
143
  end
142
144
  end
143
145
 
144
146
  def save_outputs(runnable_instance)
145
147
  outputs =
146
148
  runnable_instance.outputs_to_persist.map do |output_identifier, value|
149
+ output_name = runnable_instance.class.config.output_name(output_identifier)
150
+ output_type = runnable_instance.class.config.output_type(output_identifier)
147
151
  {
148
- name: runnable_instance.class.config.output_name(output_identifier),
149
- value: value
152
+ name: output_name,
153
+ type: output_type,
154
+ value: value.to_s
150
155
  }
151
156
  end
152
157
 
@@ -9,6 +9,10 @@ module Inferno
9
9
  @app = app
10
10
  end
11
11
 
12
+ def verbose_logging?
13
+ @verbose_logging ||= ENV['VERBOSE_REQUEST_LOGGING']&.downcase == true
14
+ end
15
+
12
16
  def logger
13
17
  @logger ||= Application['logger']
14
18
  end
@@ -35,7 +39,9 @@ module Inferno
35
39
  logger.info("#{status} in #{elapsed.in_milliseconds} ms")
36
40
  return unless body.present?
37
41
 
38
- if body.length > 100
42
+ body = body.is_a?(Array) ? body.join : body
43
+
44
+ if body.length > 100 && !verbose_logging?
39
45
  logger.info("#{body[0..100]}...")
40
46
  else
41
47
  logger.info(body)
@@ -56,7 +62,7 @@ module Inferno
56
62
 
57
63
  return unless body.present?
58
64
 
59
- if body.length > 100
65
+ if body.length > 100 && !verbose_logging?
60
66
  logger.info("#{body[0..100]}...")
61
67
  else
62
68
  logger.info(body)
@@ -1,3 +1,3 @@
1
1
  module Inferno
2
- VERSION = '0.0.7'.freeze
2
+ VERSION = '0.1.0.pre'.freeze
3
3
  end
@@ -1,7 +1,7 @@
1
1
  FactoryBot.define do
2
2
  factory :request, class: 'Inferno::Entities::Request' do
3
3
  transient do
4
- result
4
+ result { repo_create(:result, request_count: 0) }
5
5
  header_count { 2 }
6
6
  end
7
7
 
@@ -2,7 +2,7 @@ FactoryBot.define do
2
2
  factory :result, class: 'Inferno::Entities::Result' do
3
3
  transient do
4
4
  runnable { test_run.runnable.reference_hash }
5
- test_run
5
+ test_run { repo_create(:test_run) }
6
6
  test_session { test_run.test_session }
7
7
  message_count { 0 }
8
8
  request_count { 0 }
@@ -23,7 +23,7 @@ FactoryBot.define do
23
23
  before(:create) do |instance, evaluator|
24
24
  instance.instance_variable_set(
25
25
  :@requests,
26
- repo_create_list(:request, evaluator.request_count, result_id: instance.id)
26
+ build_list(:request, evaluator.request_count, result: instance)
27
27
  )
28
28
  end
29
29
 
@@ -2,6 +2,7 @@ module BasicTestSuite
2
2
  class AbcGroup < Inferno::Entities::TestGroup
3
3
  title 'ABC Group'
4
4
 
5
+ input :input1, :input2
5
6
  test 'demo_test' do
6
7
  1 + 1
7
8
  end
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: 0.0.7
4
+ version: 0.1.0.pre
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: 2021-10-28 00:00:00.000000000 Z
13
+ date: 2022-01-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -100,16 +100,16 @@ dependencies:
100
100
  name: fhir_client
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - "~>"
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
- version: '4.0'
105
+ version: 5.0.3
106
106
  type: :runtime
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - "~>"
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: '4.0'
112
+ version: 5.0.3
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: fhir_models
115
115
  requirement: !ruby/object:Gem::Requirement
@@ -502,6 +502,7 @@ files:
502
502
  - lib/inferno/db/migrations/003_update_session_data.rb
503
503
  - lib/inferno/db/migrations/004_add_request_results_table.rb
504
504
  - lib/inferno/db/migrations/005_add_updated_at_index_to_results.rb
505
+ - lib/inferno/db/migrations/006_remove_unused_tables.rb
505
506
  - lib/inferno/db/schema.rb
506
507
  - lib/inferno/dsl.rb
507
508
  - lib/inferno/dsl/assertions.rb
@@ -511,6 +512,7 @@ files:
511
512
  - lib/inferno/dsl/fhir_validation.rb
512
513
  - lib/inferno/dsl/http_client.rb
513
514
  - lib/inferno/dsl/http_client_builder.rb
515
+ - lib/inferno/dsl/oauth_credentials.rb
514
516
  - lib/inferno/dsl/request_storage.rb
515
517
  - lib/inferno/dsl/results.rb
516
518
  - lib/inferno/dsl/resume_test_route.rb
@@ -529,6 +531,7 @@ files:
529
531
  - lib/inferno/entities/test_session.rb
530
532
  - lib/inferno/entities/test_suite.rb
531
533
  - lib/inferno/exceptions.rb
534
+ - lib/inferno/ext/fhir_client.rb
532
535
  - lib/inferno/jobs.rb
533
536
  - lib/inferno/jobs/execute_test_run.rb
534
537
  - lib/inferno/jobs/resume_test_run.rb
@@ -588,9 +591,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
588
591
  version: 2.7.0
589
592
  required_rubygems_version: !ruby/object:Gem::Requirement
590
593
  requirements:
591
- - - ">="
594
+ - - ">"
592
595
  - !ruby/object:Gem::Version
593
- version: '0'
596
+ version: 1.3.1
594
597
  requirements: []
595
598
  rubygems_version: 3.1.6
596
599
  signing_key: