inferno_core 0.0.8 → 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.
- checksums.yaml +4 -4
- data/lib/inferno/apps/web/controllers/test_runs/create.rb +2 -1
- data/lib/inferno/db/migrations/001_create_initial_structure.rb +54 -53
- data/lib/inferno/db/migrations/002_add_wait_support.rb +2 -2
- data/lib/inferno/db/migrations/003_update_session_data.rb +7 -7
- data/lib/inferno/db/migrations/004_add_request_results_table.rb +2 -2
- data/lib/inferno/db/migrations/005_add_updated_at_index_to_results.rb +1 -1
- data/lib/inferno/db/migrations/006_remove_unused_tables.rb +38 -0
- data/lib/inferno/db/schema.rb +17 -43
- data/lib/inferno/dsl/configurable.rb +12 -5
- data/lib/inferno/dsl/fhir_client.rb +44 -6
- data/lib/inferno/dsl/fhir_client_builder.rb +16 -0
- data/lib/inferno/dsl/oauth_credentials.rb +119 -0
- data/lib/inferno/dsl/runnable.rb +20 -8
- data/lib/inferno/entities/request.rb +7 -1
- data/lib/inferno/exceptions.rb +19 -0
- data/lib/inferno/ext/fhir_client.rb +13 -0
- data/lib/inferno/public/bundle.js +14 -14
- data/lib/inferno/repositories/session_data.rb +40 -6
- data/lib/inferno/spec_support.rb +1 -1
- data/lib/inferno/test_runner.rb +8 -3
- data/lib/inferno/version.rb +1 -1
- data/spec/factories/request.rb +1 -1
- data/spec/factories/result.rb +2 -2
- data/spec/fixtures/basic_test_group.rb +1 -0
- metadata +7 -4
@@ -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:
|
13
|
+
update: { value: value }
|
11
14
|
).insert(
|
12
15
|
id: "#{test_session_id}_#{name}",
|
13
16
|
name: name,
|
14
|
-
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
|
-
|
21
|
-
.
|
22
|
-
|
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
|
data/lib/inferno/spec_support.rb
CHANGED
data/lib/inferno/test_runner.rb
CHANGED
@@ -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
|
-
|
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:
|
149
|
-
|
152
|
+
name: output_name,
|
153
|
+
type: output_type,
|
154
|
+
value: value.to_s
|
150
155
|
}
|
151
156
|
end
|
152
157
|
|
data/lib/inferno/version.rb
CHANGED
data/spec/factories/request.rb
CHANGED
data/spec/factories/result.rb
CHANGED
@@ -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
|
-
|
26
|
+
build_list(:request, evaluator.request_count, result: instance)
|
27
27
|
)
|
28
28
|
end
|
29
29
|
|
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.
|
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:
|
13
|
+
date: 2022-01-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -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:
|
596
|
+
version: 1.3.1
|
594
597
|
requirements: []
|
595
598
|
rubygems_version: 3.1.6
|
596
599
|
signing_key:
|