inferno_core 0.4.27 → 0.4.28
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/cli/main.rb +9 -0
- data/lib/inferno/apps/cli/new.rb +103 -0
- data/lib/inferno/apps/web/controllers/test_runs/destroy.rb +1 -1
- data/lib/inferno/apps/web/controllers/test_sessions/create.rb +3 -1
- data/lib/inferno/dsl/fhir_resource_validation.rb +1 -1
- data/lib/inferno/dsl/fhir_validation.rb +1 -1
- data/lib/inferno/dsl/resume_test_route.rb +6 -1
- data/lib/inferno/dsl/runnable.rb +4 -1
- data/lib/inferno/public/bundle.js +62 -12
- data/lib/inferno/repositories/results.rb +2 -6
- data/lib/inferno/repositories/test_runs.rb +1 -1
- data/lib/inferno/result_summarizer.rb +4 -0
- data/lib/inferno/test_runner.rb +9 -0
- data/lib/inferno/utils/middleware/request_logger.rb +8 -1
- data/lib/inferno/utils/named_thor_actions.rb +33 -0
- data/lib/inferno/version.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b08f117a70f17bef4baa571895c76bd3b18b6b3d052f4f0f3069760e84d977ab
|
4
|
+
data.tar.gz: 76635f57afb3288646c56083895efa21123de7797900f74a1a2fe8fe3c035b47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a846c92bede4a61f7c722340392a4913c9b9acddc569c3133a508c932666df8b201e7272778a3cefa40eb272af7b28422522729fa807897c784c32fee1e5d7e2
|
7
|
+
data.tar.gz: 2a2cd2e92157505409927534bd54263775c027f1a76f4f722e4c8272353ef249e095ae49b1d980d35dcc5b331782ad4913579d1d0e212f793754bf24ad91a942
|
@@ -3,6 +3,8 @@ require_relative 'migration'
|
|
3
3
|
require_relative 'services'
|
4
4
|
require_relative 'suite'
|
5
5
|
require_relative 'suites'
|
6
|
+
require_relative 'new'
|
7
|
+
require_relative '../../version'
|
6
8
|
|
7
9
|
module Inferno
|
8
10
|
module CLI
|
@@ -49,6 +51,13 @@ module Inferno
|
|
49
51
|
|
50
52
|
desc 'suite SUBCOMMAND ...ARGS', 'Perform suite-based operations'
|
51
53
|
subcommand 'suite', Suite
|
54
|
+
|
55
|
+
register(New, 'new', 'new TEST_KIT_NAME', 'Run `inferno new --help` for full help')
|
56
|
+
|
57
|
+
desc 'version', "Output Inferno core version (#{Inferno::VERSION})"
|
58
|
+
def version
|
59
|
+
puts "Inferno Core v#{Inferno::VERSION}"
|
60
|
+
end
|
52
61
|
end
|
53
62
|
end
|
54
63
|
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'bundler'
|
3
|
+
require_relative '../../utils/named_thor_actions'
|
4
|
+
require_relative '../../version'
|
5
|
+
|
6
|
+
module Inferno
|
7
|
+
module CLI
|
8
|
+
class New < Thor::Group
|
9
|
+
include Thor::Actions
|
10
|
+
include Inferno::Utils::NamedThorActions
|
11
|
+
|
12
|
+
desc <<~HELP
|
13
|
+
Generate a new Inferno test kit for FHIR software testing
|
14
|
+
|
15
|
+
Examples:
|
16
|
+
|
17
|
+
`inferno new test_fhir_app`
|
18
|
+
=> generates an Inferno app
|
19
|
+
|
20
|
+
`inferno new test_my_ig -a MyName`
|
21
|
+
=> generates Inferno app and specifies MyName as gemspec author
|
22
|
+
|
23
|
+
https://inferno-framework.github.io/index.html
|
24
|
+
HELP
|
25
|
+
|
26
|
+
def self.banner
|
27
|
+
'inferno new TEST_KIT_NAME'
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.source_root
|
31
|
+
File.join(__dir__, 'templates')
|
32
|
+
end
|
33
|
+
|
34
|
+
argument :name,
|
35
|
+
type: :string,
|
36
|
+
required: true,
|
37
|
+
desc: 'name for new Inferno project'
|
38
|
+
class_option :author,
|
39
|
+
type: :string,
|
40
|
+
aliases: '-a',
|
41
|
+
default: [],
|
42
|
+
repeatable: true,
|
43
|
+
desc: "Author names for gemspec file; you may use '-a' multiple times"
|
44
|
+
class_option :skip_bundle,
|
45
|
+
type: :boolean,
|
46
|
+
aliases: '-b',
|
47
|
+
default: false,
|
48
|
+
desc: 'Do not run bundle install'
|
49
|
+
|
50
|
+
add_runtime_options!
|
51
|
+
|
52
|
+
def create_app
|
53
|
+
directory('.', root_name, { mode: :preserve, recursive: true, verbose: !options['quiet'] })
|
54
|
+
|
55
|
+
bundle_install
|
56
|
+
inferno_migrate
|
57
|
+
|
58
|
+
say_unless_quiet "Created #{root_name} Inferno test kit!", :green
|
59
|
+
|
60
|
+
return unless options['pretend']
|
61
|
+
|
62
|
+
say_unless_quiet 'This was a dry run; re-run without `--pretend` to actually create project',
|
63
|
+
:yellow
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def ig_path
|
69
|
+
File.join('lib', library_name, 'igs')
|
70
|
+
end
|
71
|
+
|
72
|
+
def authors
|
73
|
+
options['author'].presence || [default_author]
|
74
|
+
end
|
75
|
+
|
76
|
+
def default_author
|
77
|
+
ENV['USER'] || ENV['USERNAME'] || 'PUT_YOUR_NAME_HERE'
|
78
|
+
end
|
79
|
+
|
80
|
+
def bundle_install
|
81
|
+
return if options['skip_bundle']
|
82
|
+
|
83
|
+
inside(root_name) do
|
84
|
+
Bundler.with_unbundled_env do
|
85
|
+
run 'bundle install', verbose: !options['quiet'], capture: options['quiet']
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def inferno_migrate
|
91
|
+
return if options['skip_bundle']
|
92
|
+
|
93
|
+
inside(root_name) do
|
94
|
+
run 'bundle exec inferno migrate', verbose: !options['quiet'], capture: options['quiet']
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def say_unless_quiet(*args)
|
99
|
+
say(*args) unless options['quiet']
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -21,7 +21,7 @@ module Inferno
|
|
21
21
|
|
22
22
|
if test_run_is_waiting
|
23
23
|
waiting_result = results_repo.find_waiting_result(test_run_id: test_run.id)
|
24
|
-
results_repo.
|
24
|
+
results_repo.update_result(waiting_result.id, 'cancel', 'Test cancelled by user')
|
25
25
|
Jobs.perform(Jobs::ResumeTestRun, test_run.id)
|
26
26
|
end
|
27
27
|
|
@@ -10,7 +10,9 @@ module Inferno
|
|
10
10
|
|
11
11
|
def handle(req, res)
|
12
12
|
params = req.params.to_h
|
13
|
-
|
13
|
+
if req.body.string.present? && req.env['CONTENT_TYPE']&.include?('application/json')
|
14
|
+
params.merge!(JSON.parse(req.body.string).symbolize_keys)
|
15
|
+
end
|
14
16
|
|
15
17
|
session = repo.create(create_params(params))
|
16
18
|
|
@@ -28,6 +28,11 @@ module Inferno
|
|
28
28
|
self.class.singleton_class.instance_variable_get(:@tags)
|
29
29
|
end
|
30
30
|
|
31
|
+
# @private
|
32
|
+
def result
|
33
|
+
self.class.singleton_class.instance_variable_get(:@result)
|
34
|
+
end
|
35
|
+
|
31
36
|
# @private
|
32
37
|
def find_test_run(test_run_identifier)
|
33
38
|
test_runs_repo.find_latest_waiting_by_identifier(test_run_identifier)
|
@@ -40,7 +45,7 @@ module Inferno
|
|
40
45
|
|
41
46
|
# @private
|
42
47
|
def update_result(waiting_result)
|
43
|
-
results_repo.
|
48
|
+
results_repo.update_result(waiting_result.id, result)
|
44
49
|
end
|
45
50
|
|
46
51
|
# @private
|
data/lib/inferno/dsl/runnable.rb
CHANGED
@@ -342,16 +342,19 @@ module Inferno
|
|
342
342
|
# Router](https://github.com/hanami/router/tree/f41001d4c3ee9e2d2c7bb142f74b43f8e1d3a265#a-beautiful-dsl)
|
343
343
|
# can be used here.
|
344
344
|
# @param tags [Array<String>] a list of tags to assign to the request
|
345
|
+
# @param result [String] the result for the waiting test. Must be one of:
|
346
|
+
# 'pass', 'fail', 'skip', 'omit', 'cancel'
|
345
347
|
# @yield This method takes a block which must return the identifier
|
346
348
|
# defined when a test was set to wait for the test run that hit this
|
347
349
|
# route. The block has access to the `request` method which returns a
|
348
350
|
# {Inferno::Entities::Request} object with the information for the
|
349
351
|
# incoming request.
|
350
352
|
# @return [void]
|
351
|
-
def resume_test_route(method, path, tags: [], &block)
|
353
|
+
def resume_test_route(method, path, tags: [], result: 'pass', &block)
|
352
354
|
route_class = Class.new(ResumeTestRoute) do |klass|
|
353
355
|
klass.singleton_class.instance_variable_set(:@test_run_identifier_block, block)
|
354
356
|
klass.singleton_class.instance_variable_set(:@tags, tags)
|
357
|
+
klass.singleton_class.instance_variable_set(:@result, result)
|
355
358
|
end
|
356
359
|
|
357
360
|
route(method, path, route_class)
|