inferno_core 0.0.2 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inferno/apps/web/controllers/test_runs/create.rb +30 -10
- data/lib/inferno/apps/web/controllers/test_runs/show.rb +10 -0
- data/lib/inferno/apps/web/controllers/test_sessions/create.rb +1 -0
- data/lib/inferno/apps/web/controllers/test_sessions/last_test_run.rb +22 -0
- data/lib/inferno/apps/web/controllers/test_sessions/results/index.rb +6 -1
- data/lib/inferno/apps/web/controllers/test_sessions/session_data/index.rb +21 -0
- data/lib/inferno/apps/web/router.rb +15 -0
- data/lib/inferno/apps/web/serializers/hash_value_extractor.rb +11 -0
- data/lib/inferno/apps/web/serializers/request.rb +1 -0
- data/lib/inferno/apps/web/serializers/result.rb +8 -0
- data/lib/inferno/apps/web/serializers/session_data.rb +10 -0
- data/lib/inferno/apps/web/serializers/test.rb +3 -6
- data/lib/inferno/apps/web/serializers/test_group.rb +5 -8
- data/lib/inferno/apps/web/serializers/test_run.rb +1 -0
- data/lib/inferno/apps/web/serializers/test_session.rb +1 -1
- data/lib/inferno/apps/web/serializers/test_suite.rb +1 -0
- data/lib/inferno/config/application.rb +5 -2
- data/lib/inferno/config/boot/db.rb +10 -1
- data/lib/inferno/config/boot/sidekiq.rb +11 -0
- data/lib/inferno/config/boot/suites.rb +4 -6
- data/lib/inferno/config/boot.rb +2 -0
- data/lib/inferno/db/migrations/001_create_initial_structure.rb +0 -21
- data/lib/inferno/db/migrations/002_add_wait_support.rb +7 -0
- data/lib/inferno/db/migrations/003_update_session_data.rb +18 -0
- data/lib/inferno/db/migrations/004_add_request_results_table.rb +9 -0
- data/lib/inferno/db/migrations/005_add_updated_at_index_to_results.rb +5 -0
- data/lib/inferno/db/schema.rb +154 -0
- data/lib/inferno/dsl/assertions.rb +20 -0
- data/lib/inferno/dsl/configurable.rb +126 -0
- data/lib/inferno/dsl/fhir_client.rb +4 -2
- data/lib/inferno/dsl/fhir_client_builder.rb +16 -0
- data/lib/inferno/dsl/http_client.rb +10 -8
- data/lib/inferno/dsl/request_storage.rb +30 -9
- data/lib/inferno/dsl/results.rb +49 -0
- data/lib/inferno/dsl/resume_test_route.rb +89 -0
- data/lib/inferno/dsl/runnable.rb +153 -16
- data/lib/inferno/dsl.rb +1 -3
- data/lib/inferno/entities/header.rb +7 -7
- data/lib/inferno/entities/message.rb +8 -6
- data/lib/inferno/entities/request.rb +42 -16
- data/lib/inferno/entities/result.rb +34 -18
- data/lib/inferno/entities/session_data.rb +33 -0
- data/lib/inferno/entities/test.rb +35 -8
- data/lib/inferno/entities/test_group.rb +8 -0
- data/lib/inferno/entities/test_run.rb +13 -6
- data/lib/inferno/entities/test_session.rb +8 -8
- data/lib/inferno/entities.rb +1 -1
- data/lib/inferno/exceptions.rb +24 -0
- data/lib/inferno/jobs/execute_test_run.rb +14 -0
- data/lib/inferno/jobs/resume_test_run.rb +14 -0
- data/lib/inferno/jobs.rb +16 -0
- data/lib/inferno/public/bundle.js +1 -1
- data/lib/inferno/repositories/repository.rb +13 -0
- data/lib/inferno/repositories/requests.rb +5 -4
- data/lib/inferno/repositories/results.rb +151 -3
- data/lib/inferno/repositories/session_data.rb +47 -0
- data/lib/inferno/repositories/test_runs.rb +81 -0
- data/lib/inferno/test_runner.rb +125 -31
- data/lib/inferno/utils/markdown_formatter.rb +15 -0
- data/lib/inferno/utils/middleware/request_logger.rb +16 -3
- data/lib/inferno/version.rb +1 -1
- data/lib/inferno.rb +4 -0
- data/spec/factories/header.rb +19 -0
- data/spec/factories/message.rb +17 -0
- data/spec/factories/request.rb +42 -0
- data/spec/factories/result.rb +45 -0
- data/spec/factories/test_run.rb +24 -0
- data/spec/factories/test_session.rb +11 -0
- data/spec/fixtures/basic_test_group.rb +9 -0
- data/spec/fixtures/basic_test_suite.rb +8 -0
- metadata +57 -5
- data/lib/inferno/dsl/fhir_manipulation.rb +0 -25
- data/lib/inferno/entities/test_input.rb +0 -20
@@ -0,0 +1,17 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :message, class: 'Inferno::Entities::Message' do
|
3
|
+
result
|
4
|
+
|
5
|
+
result_id { result.id }
|
6
|
+
|
7
|
+
sequence(:message) { |n| "MESSAGE #{n}" }
|
8
|
+
|
9
|
+
type { Inferno::Entities::Message::TYPES.sample }
|
10
|
+
|
11
|
+
initialize_with { new(**attributes) }
|
12
|
+
|
13
|
+
to_create do |instance|
|
14
|
+
Inferno::Repositories::Messages.new.create(instance.to_hash)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :request, class: 'Inferno::Entities::Request' do
|
3
|
+
transient do
|
4
|
+
result
|
5
|
+
header_count { 2 }
|
6
|
+
end
|
7
|
+
|
8
|
+
result_id { result.id }
|
9
|
+
|
10
|
+
verb { 'get' }
|
11
|
+
url { 'http://www.example.com' }
|
12
|
+
name { nil }
|
13
|
+
status { 200 }
|
14
|
+
direction { 'outgoing' }
|
15
|
+
headers do
|
16
|
+
[
|
17
|
+
{
|
18
|
+
type: 'request',
|
19
|
+
name: 'Request-Header',
|
20
|
+
value: 'REQUEST HEADER VALUE'
|
21
|
+
},
|
22
|
+
{
|
23
|
+
type: 'response',
|
24
|
+
name: 'Response-Header',
|
25
|
+
value: 'RESPONSE HEADER VALUE'
|
26
|
+
}
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
request_body { nil }
|
31
|
+
|
32
|
+
sequence(:response_body) { |n| "RESPONSE_BODY #{n}" }
|
33
|
+
|
34
|
+
test_session_id { result.test_session_id }
|
35
|
+
|
36
|
+
initialize_with { new(**attributes) }
|
37
|
+
|
38
|
+
to_create do |instance|
|
39
|
+
Inferno::Repositories::Requests.new.create(instance.to_hash)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :result, class: 'Inferno::Entities::Result' do
|
3
|
+
transient do
|
4
|
+
runnable { test_run.runnable.reference_hash }
|
5
|
+
test_run
|
6
|
+
test_session { test_run.test_session }
|
7
|
+
message_count { 0 }
|
8
|
+
request_count { 0 }
|
9
|
+
end
|
10
|
+
|
11
|
+
test_session_id { test_session.id }
|
12
|
+
test_run_id { test_run.id }
|
13
|
+
|
14
|
+
test_suite_id { runnable[:test_suite_id] }
|
15
|
+
test_group_id { runnable[:test_group_id] }
|
16
|
+
test_id { runnable[:test_id] }
|
17
|
+
output_json { '[]' }
|
18
|
+
|
19
|
+
result { 'pass' }
|
20
|
+
|
21
|
+
initialize_with { new(**attributes) }
|
22
|
+
|
23
|
+
before(:create) do |instance, evaluator|
|
24
|
+
instance.instance_variable_set(
|
25
|
+
:@requests,
|
26
|
+
repo_create_list(:request, evaluator.request_count, result_id: instance.id)
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
to_create do |instance|
|
31
|
+
Inferno::Repositories::Results.new.create(instance.to_hash)
|
32
|
+
end
|
33
|
+
|
34
|
+
after(:create) do |instance, evaluator|
|
35
|
+
instance.instance_variable_set(
|
36
|
+
:@messages,
|
37
|
+
repo_create_list(:message, evaluator.message_count, result_id: instance.id)
|
38
|
+
)
|
39
|
+
instance.instance_variable_set(
|
40
|
+
:@requests,
|
41
|
+
repo_create_list(:request, evaluator.request_count, result_id: instance.id)
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :test_run, class: 'Inferno::Entities::TestRun' do
|
3
|
+
test_session
|
4
|
+
test_session_id { test_session.id }
|
5
|
+
|
6
|
+
transient do
|
7
|
+
runnable { { test_suite_id: 'BasicTestSuite::Suite' } }
|
8
|
+
end
|
9
|
+
|
10
|
+
test_suite_id { runnable[:test_suite_id] }
|
11
|
+
test_group_id { runnable[:test_group_id] }
|
12
|
+
test_id { runnable[:test_id] }
|
13
|
+
status { 'queued' }
|
14
|
+
|
15
|
+
inputs { nil }
|
16
|
+
wait_timeout { nil }
|
17
|
+
|
18
|
+
initialize_with { new(**attributes) }
|
19
|
+
|
20
|
+
to_create do |instance|
|
21
|
+
Inferno::Repositories::TestRuns.new.create(instance.to_hash).tap(&:runnable)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative '../../lib/inferno/repositories'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :test_session, class: 'Inferno::Entities::TestSession' do
|
5
|
+
test_suite_id { 'BasicTestSuite::Suite' }
|
6
|
+
|
7
|
+
initialize_with { new(**attributes) }
|
8
|
+
|
9
|
+
to_create { |instance| Inferno::Repositories::TestSessions.new.create(instance.to_hash) }
|
10
|
+
end
|
11
|
+
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.
|
4
|
+
version: 0.0.6
|
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-
|
13
|
+
date: 2021-10-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -96,6 +96,20 @@ dependencies:
|
|
96
96
|
- - "~>"
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '4.0'
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: fhir_models
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 4.2.0
|
106
|
+
type: :runtime
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 4.2.0
|
99
113
|
- !ruby/object:Gem::Dependency
|
100
114
|
name: hanami-controller
|
101
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,6 +222,20 @@ dependencies:
|
|
208
222
|
- - "~>"
|
209
223
|
- !ruby/object:Gem::Version
|
210
224
|
version: '5.42'
|
225
|
+
- !ruby/object:Gem::Dependency
|
226
|
+
name: sidekiq
|
227
|
+
requirement: !ruby/object:Gem::Requirement
|
228
|
+
requirements:
|
229
|
+
- - "~>"
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
version: 6.2.1
|
232
|
+
type: :runtime
|
233
|
+
prerelease: false
|
234
|
+
version_requirements: !ruby/object:Gem::Requirement
|
235
|
+
requirements:
|
236
|
+
- - "~>"
|
237
|
+
- !ruby/object:Gem::Version
|
238
|
+
version: 6.2.1
|
211
239
|
- !ruby/object:Gem::Dependency
|
212
240
|
name: sqlite3
|
213
241
|
requirement: !ruby/object:Gem::Requirement
|
@@ -409,18 +437,22 @@ files:
|
|
409
437
|
- lib/inferno/apps/web/controllers/test_runs/results/index.rb
|
410
438
|
- lib/inferno/apps/web/controllers/test_runs/show.rb
|
411
439
|
- lib/inferno/apps/web/controllers/test_sessions/create.rb
|
440
|
+
- lib/inferno/apps/web/controllers/test_sessions/last_test_run.rb
|
412
441
|
- lib/inferno/apps/web/controllers/test_sessions/results/index.rb
|
442
|
+
- lib/inferno/apps/web/controllers/test_sessions/session_data/index.rb
|
413
443
|
- lib/inferno/apps/web/controllers/test_sessions/show.rb
|
414
444
|
- lib/inferno/apps/web/controllers/test_suites/index.rb
|
415
445
|
- lib/inferno/apps/web/controllers/test_suites/show.rb
|
416
446
|
- lib/inferno/apps/web/index.html.erb
|
417
447
|
- lib/inferno/apps/web/router.rb
|
448
|
+
- lib/inferno/apps/web/serializers/hash_value_extractor.rb
|
418
449
|
- lib/inferno/apps/web/serializers/header.rb
|
419
450
|
- lib/inferno/apps/web/serializers/input.rb
|
420
451
|
- lib/inferno/apps/web/serializers/message.rb
|
421
452
|
- lib/inferno/apps/web/serializers/request.rb
|
422
453
|
- lib/inferno/apps/web/serializers/result.rb
|
423
454
|
- lib/inferno/apps/web/serializers/serializer.rb
|
455
|
+
- lib/inferno/apps/web/serializers/session_data.rb
|
424
456
|
- lib/inferno/apps/web/serializers/test.rb
|
425
457
|
- lib/inferno/apps/web/serializers/test_group.rb
|
426
458
|
- lib/inferno/apps/web/serializers/test_run.rb
|
@@ -430,19 +462,26 @@ files:
|
|
430
462
|
- lib/inferno/config/boot.rb
|
431
463
|
- lib/inferno/config/boot/db.rb
|
432
464
|
- lib/inferno/config/boot/logging.rb
|
465
|
+
- lib/inferno/config/boot/sidekiq.rb
|
433
466
|
- lib/inferno/config/boot/suites.rb
|
434
467
|
- lib/inferno/config/boot/web.rb
|
435
468
|
- lib/inferno/db/migrations/001_create_initial_structure.rb
|
469
|
+
- lib/inferno/db/migrations/002_add_wait_support.rb
|
470
|
+
- lib/inferno/db/migrations/003_update_session_data.rb
|
471
|
+
- lib/inferno/db/migrations/004_add_request_results_table.rb
|
472
|
+
- lib/inferno/db/migrations/005_add_updated_at_index_to_results.rb
|
473
|
+
- lib/inferno/db/schema.rb
|
436
474
|
- lib/inferno/dsl.rb
|
437
475
|
- lib/inferno/dsl/assertions.rb
|
476
|
+
- lib/inferno/dsl/configurable.rb
|
438
477
|
- lib/inferno/dsl/fhir_client.rb
|
439
478
|
- lib/inferno/dsl/fhir_client_builder.rb
|
440
|
-
- lib/inferno/dsl/fhir_manipulation.rb
|
441
479
|
- lib/inferno/dsl/fhir_validation.rb
|
442
480
|
- lib/inferno/dsl/http_client.rb
|
443
481
|
- lib/inferno/dsl/http_client_builder.rb
|
444
482
|
- lib/inferno/dsl/request_storage.rb
|
445
483
|
- lib/inferno/dsl/results.rb
|
484
|
+
- lib/inferno/dsl/resume_test_route.rb
|
446
485
|
- lib/inferno/dsl/runnable.rb
|
447
486
|
- lib/inferno/entities.rb
|
448
487
|
- lib/inferno/entities/attributes.rb
|
@@ -451,13 +490,16 @@ files:
|
|
451
490
|
- lib/inferno/entities/message.rb
|
452
491
|
- lib/inferno/entities/request.rb
|
453
492
|
- lib/inferno/entities/result.rb
|
493
|
+
- lib/inferno/entities/session_data.rb
|
454
494
|
- lib/inferno/entities/test.rb
|
455
495
|
- lib/inferno/entities/test_group.rb
|
456
|
-
- lib/inferno/entities/test_input.rb
|
457
496
|
- lib/inferno/entities/test_run.rb
|
458
497
|
- lib/inferno/entities/test_session.rb
|
459
498
|
- lib/inferno/entities/test_suite.rb
|
460
499
|
- lib/inferno/exceptions.rb
|
500
|
+
- lib/inferno/jobs.rb
|
501
|
+
- lib/inferno/jobs/execute_test_run.rb
|
502
|
+
- lib/inferno/jobs/resume_test_run.rb
|
461
503
|
- lib/inferno/public/217.bundle.js
|
462
504
|
- lib/inferno/public/assets.json
|
463
505
|
- lib/inferno/public/bundle.js
|
@@ -473,6 +515,7 @@ files:
|
|
473
515
|
- lib/inferno/repositories/repository.rb
|
474
516
|
- lib/inferno/repositories/requests.rb
|
475
517
|
- lib/inferno/repositories/results.rb
|
518
|
+
- lib/inferno/repositories/session_data.rb
|
476
519
|
- lib/inferno/repositories/test_groups.rb
|
477
520
|
- lib/inferno/repositories/test_runs.rb
|
478
521
|
- lib/inferno/repositories/test_sessions.rb
|
@@ -481,8 +524,17 @@ files:
|
|
481
524
|
- lib/inferno/repositories/validate_runnable_reference.rb
|
482
525
|
- lib/inferno/spec_support.rb
|
483
526
|
- lib/inferno/test_runner.rb
|
527
|
+
- lib/inferno/utils/markdown_formatter.rb
|
484
528
|
- lib/inferno/utils/middleware/request_logger.rb
|
485
529
|
- lib/inferno/version.rb
|
530
|
+
- spec/factories/header.rb
|
531
|
+
- spec/factories/message.rb
|
532
|
+
- spec/factories/request.rb
|
533
|
+
- spec/factories/result.rb
|
534
|
+
- spec/factories/test_run.rb
|
535
|
+
- spec/factories/test_session.rb
|
536
|
+
- spec/fixtures/basic_test_group.rb
|
537
|
+
- spec/fixtures/basic_test_suite.rb
|
486
538
|
- spec/support/factory_bot.rb
|
487
539
|
homepage: https://github.com/inferno_community/inferno-core
|
488
540
|
licenses:
|
@@ -507,7 +559,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
507
559
|
- !ruby/object:Gem::Version
|
508
560
|
version: '0'
|
509
561
|
requirements: []
|
510
|
-
rubygems_version: 3.1.
|
562
|
+
rubygems_version: 3.1.6
|
511
563
|
signing_key:
|
512
564
|
specification_version: 4
|
513
565
|
summary: Inferno Core is an open source tool for testing data exchanges enabled by
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Inferno
|
2
|
-
module DSL
|
3
|
-
module FHIRManipulation
|
4
|
-
def walk_resource(resource, path = nil, &block)
|
5
|
-
resource.class::METADATA.each do |field_name, meta|
|
6
|
-
local_name = meta.fetch :local_name, field_name
|
7
|
-
values = [resource.instance_variable_get("@#{local_name}")].flatten.compact
|
8
|
-
next if values.empty?
|
9
|
-
|
10
|
-
values.each_with_index do |value, i|
|
11
|
-
child_path = if path.nil?
|
12
|
-
field_name
|
13
|
-
elsif meta['max'] > 1
|
14
|
-
"#{path}.#{field_name}[#{i}]"
|
15
|
-
else
|
16
|
-
"#{path}.#{field_name}"
|
17
|
-
end
|
18
|
-
yield value, meta, child_path
|
19
|
-
walk_resource value, child_path, &block unless FHIR::PRIMITIVES.include? meta['type']
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Inferno
|
2
|
-
module Entities
|
3
|
-
# A `TestRun` represents an input definition in a test.
|
4
|
-
#
|
5
|
-
# @attr_reader [String] id of the test input
|
6
|
-
# @attr_reader [String] status
|
7
|
-
# @attr_reader [String] test_suite_id
|
8
|
-
class TestInput
|
9
|
-
attr_reader :id, :status, :test_suite_id
|
10
|
-
|
11
|
-
# How to define test run inputs? Class in this file? Separate Entity?
|
12
|
-
|
13
|
-
def initialize(params)
|
14
|
-
@id = params[:id]
|
15
|
-
@status = params[:name]
|
16
|
-
@test_suite_id = params[:test_suite_id]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|