inferno_core 0.3.12 → 0.4.0
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/application.rb +1 -0
- data/lib/inferno/apps/web/controllers/controller.rb +6 -8
- data/lib/inferno/apps/web/controllers/requests/show.rb +3 -3
- data/lib/inferno/apps/web/controllers/test_runs/create.rb +13 -17
- data/lib/inferno/apps/web/controllers/test_runs/destroy.rb +8 -10
- data/lib/inferno/apps/web/controllers/test_runs/results/index.rb +4 -4
- data/lib/inferno/apps/web/controllers/test_runs/show.rb +9 -7
- data/lib/inferno/apps/web/controllers/test_sessions/create.rb +9 -8
- data/lib/inferno/apps/web/controllers/test_sessions/last_test_run.rb +4 -4
- data/lib/inferno/apps/web/controllers/test_sessions/results/index.rb +6 -6
- data/lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb +10 -10
- data/lib/inferno/apps/web/controllers/test_sessions/session_data/index.rb +5 -3
- data/lib/inferno/apps/web/controllers/test_sessions/show.rb +3 -3
- data/lib/inferno/apps/web/controllers/test_suites/check_configuration.rb +3 -3
- data/lib/inferno/apps/web/controllers/test_suites/index.rb +2 -2
- data/lib/inferno/apps/web/controllers/test_suites/show.rb +3 -3
- data/lib/inferno/apps/web/router.rb +55 -41
- data/lib/inferno/apps/web/serializers/message.rb +2 -0
- data/lib/inferno/apps/web/serializers/preset.rb +2 -5
- data/lib/inferno/apps/web/serializers/request.rb +2 -0
- data/lib/inferno/apps/web/serializers/result.rb +1 -0
- data/lib/inferno/apps/web/serializers/session_data.rb +2 -0
- data/lib/inferno/apps/web/serializers/suite_option.rb +2 -0
- data/lib/inferno/apps/web/serializers/test.rb +3 -0
- data/lib/inferno/apps/web/serializers/test_group.rb +4 -2
- data/lib/inferno/apps/web/serializers/test_run.rb +3 -0
- data/lib/inferno/apps/web/serializers/test_suite.rb +5 -1
- data/lib/inferno/config/application.rb +1 -6
- data/lib/inferno/config/boot/web.rb +2 -7
- data/lib/inferno/dsl/assertions.rb +2 -2
- data/lib/inferno/dsl/configurable.rb +4 -4
- data/lib/inferno/dsl/fhir_client.rb +3 -2
- data/lib/inferno/dsl/fhir_client_builder.rb +2 -2
- data/lib/inferno/dsl/fhir_validation.rb +5 -6
- data/lib/inferno/dsl/http_client.rb +17 -18
- data/lib/inferno/dsl/http_client_builder.rb +4 -4
- data/lib/inferno/dsl/input_output_handling.rb +1 -1
- data/lib/inferno/dsl/request_storage.rb +2 -2
- data/lib/inferno/dsl/resume_test_route.rb +36 -34
- data/lib/inferno/dsl/runnable.rb +8 -9
- data/lib/inferno/entities/header.rb +7 -7
- data/lib/inferno/entities/request.rb +35 -36
- data/lib/inferno/entities/session_data.rb +6 -6
- data/lib/inferno/entities/test.rb +4 -4
- data/lib/inferno/entities/test_group.rb +2 -2
- data/lib/inferno/entities/test_run.rb +1 -1
- data/lib/inferno/jobs/execute_test_run.rb +1 -1
- data/lib/inferno/jobs/resume_test_run.rb +1 -1
- data/lib/inferno/public/bundle.js +2 -2
- data/lib/inferno/repositories/messages.rb +1 -1
- data/lib/inferno/repositories/repository.rb +1 -1
- data/lib/inferno/repositories/requests.rb +6 -6
- data/lib/inferno/repositories/results.rb +16 -16
- data/lib/inferno/repositories/session_data.rb +6 -6
- data/lib/inferno/repositories/test_runs.rb +6 -6
- data/lib/inferno/repositories/test_sessions.rb +7 -7
- data/lib/inferno/test_runner.rb +3 -3
- data/lib/inferno/utils/preset_template_generator.rb +1 -1
- data/lib/inferno/version.rb +1 -1
- data/spec/factories/test_run.rb +1 -1
- data/spec/factories/test_session.rb +1 -1
- data/spec/fixtures/basic_test_suite.rb +1 -0
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 987a2db725cb3b2517f392d2e566614f3e5fcd454f27164e6de64ec615b5661c
|
4
|
+
data.tar.gz: 1cce12a803e20d288e72f9f3b1dfd1def94f9cbe1fcb73f4c862f1063c3d5c8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 646f385e975efc9eb957aa707934e7c3e04977c97bd73dae4a21a8dbfd60869c1662f1832bfac1a38cb534ed18ebc93d771937a8978a7fb5dba7e0b3db54b974
|
7
|
+
data.tar.gz: 106dc72ddaaba5f02be715aef376984adb7c97ae71c62668d45da094bcfe430ee1a7c5d940c99e92bfc645bc31c8bb2013406aaffb2a072fc1d0fc9771a3187f
|
@@ -1,20 +1,18 @@
|
|
1
1
|
module Inferno
|
2
2
|
module Web
|
3
3
|
module Controllers
|
4
|
-
class Controller
|
5
|
-
|
6
|
-
|
7
|
-
new.call(params)
|
4
|
+
class Controller < Hanami::Action
|
5
|
+
def self.call(...)
|
6
|
+
new.call(...)
|
8
7
|
end
|
9
8
|
|
10
9
|
def self.inherited(subclass)
|
11
10
|
super
|
12
11
|
|
13
|
-
|
14
|
-
# subclass rather than superclass.
|
15
|
-
subclass.include Hanami::Action
|
12
|
+
subclass.include Import[repo: "inferno.repositories.#{subclass.resource_name}"]
|
16
13
|
|
17
|
-
subclass.
|
14
|
+
subclass.config.default_request_format = :json
|
15
|
+
subclass.config.default_response_format = :json
|
18
16
|
|
19
17
|
subclass.define_method(:serialize) do |*args|
|
20
18
|
Inferno::Web::Serializers.const_get(self.class.resource_class).render(*args)
|
@@ -3,11 +3,11 @@ module Inferno
|
|
3
3
|
module Controllers
|
4
4
|
module Requests
|
5
5
|
class Show < Controller
|
6
|
-
def
|
7
|
-
request = repo.find_full_request(params[:id])
|
6
|
+
def handle(req, res)
|
7
|
+
request = repo.find_full_request(req.params[:id])
|
8
8
|
halt 404 if request.nil?
|
9
9
|
|
10
|
-
|
10
|
+
res.body = serialize(request, view: :full)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -4,9 +4,9 @@ module Inferno
|
|
4
4
|
module TestRuns
|
5
5
|
class Create < Controller
|
6
6
|
include Import[
|
7
|
-
test_sessions_repo: 'repositories.test_sessions',
|
8
|
-
session_data_repo: 'repositories.session_data',
|
9
|
-
test_runs_repo: 'repositories.test_runs'
|
7
|
+
test_sessions_repo: 'inferno.repositories.test_sessions',
|
8
|
+
session_data_repo: 'inferno.repositories.session_data',
|
9
|
+
test_runs_repo: 'inferno.repositories.test_runs'
|
10
10
|
]
|
11
11
|
|
12
12
|
PARAMS = [:test_session_id, :test_suite_id, :test_group_id, :test_id].freeze
|
@@ -42,38 +42,34 @@ module Inferno
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
46
|
-
test_session = test_sessions_repo.find(params[:test_session_id])
|
45
|
+
def handle(req, res)
|
46
|
+
test_session = test_sessions_repo.find(req.params[:test_session_id])
|
47
47
|
|
48
48
|
# if testsession.nil?
|
49
49
|
if test_runs_repo.active_test_run_for_session?(test_session.id)
|
50
|
-
|
51
|
-
self.body = { error: 'Cannot run new test while another test run is in progress' }.to_json
|
52
|
-
return
|
50
|
+
halt 409, { error: 'Cannot run new test while another test run is in progress' }.to_json
|
53
51
|
end
|
54
52
|
|
55
53
|
verify_runnable(
|
56
|
-
repo.build_entity(create_params(params)).runnable,
|
57
|
-
params[:inputs],
|
54
|
+
repo.build_entity(create_params(req.params)).runnable,
|
55
|
+
req.params[:inputs],
|
58
56
|
test_session.suite_options
|
59
57
|
)
|
60
58
|
|
61
|
-
test_run = repo.create(create_params(params).merge(status: 'queued'))
|
59
|
+
test_run = repo.create(create_params(req.params).merge(status: 'queued'))
|
62
60
|
|
63
|
-
|
61
|
+
res.body = serialize(test_run, suite_options: test_session.suite_options)
|
64
62
|
|
65
|
-
persist_inputs(params, test_run)
|
63
|
+
persist_inputs(req.params, test_run)
|
66
64
|
|
67
65
|
Jobs.perform(Jobs::ExecuteTestRun, test_run.id)
|
68
66
|
rescue Sequel::ValidationFailed, Sequel::ForeignKeyConstraintViolation,
|
69
67
|
Inferno::Exceptions::RequiredInputsNotFound,
|
70
68
|
Inferno::Exceptions::NotUserRunnableException => e
|
71
|
-
|
72
|
-
self.status = 422
|
69
|
+
halt 422, { errors: e.message }.to_json
|
73
70
|
rescue StandardError => e
|
74
71
|
Application['logger'].error(e.full_message)
|
75
|
-
|
76
|
-
self.status = 500
|
72
|
+
halt 500, { errors: e.message }.to_json
|
77
73
|
end
|
78
74
|
|
79
75
|
def create_params(params)
|
@@ -4,21 +4,20 @@ module Inferno
|
|
4
4
|
module TestRuns
|
5
5
|
class Destroy < Controller
|
6
6
|
include Import[
|
7
|
-
test_runs_repo: 'repositories.test_runs',
|
8
|
-
results_repo: 'repositories.results'
|
7
|
+
test_runs_repo: 'inferno.repositories.test_runs',
|
8
|
+
results_repo: 'inferno.repositories.results'
|
9
9
|
]
|
10
10
|
|
11
|
-
def
|
12
|
-
test_run = test_runs_repo.find(params[:id])
|
11
|
+
def handle(req, res)
|
12
|
+
test_run = test_runs_repo.find(req.params[:id])
|
13
13
|
|
14
14
|
if test_run.nil? || ['done', 'cancelling'].include?(test_run.status)
|
15
15
|
# If it doesn't exist, already finished, or currently being cancelled
|
16
|
-
|
17
|
-
return
|
16
|
+
halt 204
|
18
17
|
end
|
19
18
|
|
20
19
|
test_run_is_waiting = (test_run.status == 'waiting')
|
21
|
-
test_runs_repo.mark_as_cancelling(params[:id])
|
20
|
+
test_runs_repo.mark_as_cancelling(req.params[:id])
|
22
21
|
|
23
22
|
if test_run_is_waiting
|
24
23
|
waiting_result = results_repo.find_waiting_result(test_run_id: test_run.id)
|
@@ -26,11 +25,10 @@ module Inferno
|
|
26
25
|
Jobs.perform(Jobs::ResumeTestRun, test_run.id)
|
27
26
|
end
|
28
27
|
|
29
|
-
|
28
|
+
res.status = 204
|
30
29
|
rescue StandardError => e
|
31
30
|
Application['logger'].error(e.full_message)
|
32
|
-
|
33
|
-
self.status = 500
|
31
|
+
halt 500, { errors: e.message }.to_json
|
34
32
|
end
|
35
33
|
end
|
36
34
|
end
|
@@ -4,11 +4,11 @@ module Inferno
|
|
4
4
|
module TestRuns
|
5
5
|
module Results
|
6
6
|
class Index < Controller
|
7
|
-
include Import[test_runs_repo: 'repositories.test_runs']
|
7
|
+
include Import[test_runs_repo: 'inferno.repositories.test_runs']
|
8
8
|
|
9
|
-
def
|
10
|
-
results = test_runs_repo.results_for_test_run(params[:test_run_id])
|
11
|
-
|
9
|
+
def handle(req, res)
|
10
|
+
results = test_runs_repo.results_for_test_run(req.params[:test_run_id])
|
11
|
+
res.body = serialize(results)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -1,26 +1,28 @@
|
|
1
|
+
require_relative '../../serializers/test_run'
|
2
|
+
|
1
3
|
module Inferno
|
2
4
|
module Web
|
3
5
|
module Controllers
|
4
6
|
module TestRuns
|
5
7
|
class Show < Controller
|
6
|
-
include Import[test_sessions_repo: 'repositories.test_sessions']
|
8
|
+
include Import[test_sessions_repo: 'inferno.repositories.test_sessions']
|
7
9
|
|
8
|
-
def
|
9
|
-
test_run = repo.find(params[:id])
|
10
|
+
def handle(req, res)
|
11
|
+
test_run = repo.find(req.params[:id])
|
10
12
|
halt 404 if test_run.nil?
|
11
13
|
|
12
|
-
if params[:include_results] == 'true'
|
14
|
+
if req.params[:include_results] == 'true'
|
13
15
|
results_repo = Inferno::Repositories::Results.new
|
14
16
|
test_run.results =
|
15
|
-
if params[:after].present?
|
16
|
-
results_repo.test_run_results_after(test_run_id: test_run.id, after: Time.parse(params[:after]))
|
17
|
+
if req.params[:after].present?
|
18
|
+
results_repo.test_run_results_after(test_run_id: test_run.id, after: Time.parse(req.params[:after]))
|
17
19
|
else
|
18
20
|
repo.results_for_test_run(test_run.id)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
24
|
test_session = test_sessions_repo.find(test_run.test_session_id)
|
23
|
-
|
25
|
+
res.body = serialize(test_run, suite_options: test_session.suite_options)
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require_relative '../controller'
|
2
|
+
require_relative '../../serializers/test_session'
|
3
|
+
|
1
4
|
module Inferno
|
2
5
|
module Web
|
3
6
|
module Controllers
|
@@ -5,22 +8,20 @@ module Inferno
|
|
5
8
|
class Create < Controller
|
6
9
|
PARAMS = [:test_suite_id, :suite_options].freeze
|
7
10
|
|
8
|
-
def
|
9
|
-
params =
|
10
|
-
params.merge!(JSON.parse(
|
11
|
+
def handle(req, res)
|
12
|
+
params = req.params.to_h
|
13
|
+
params.merge!(JSON.parse(req.body.string).symbolize_keys) unless req.body.string.blank?
|
11
14
|
|
12
15
|
session = repo.create(create_params(params))
|
13
16
|
|
14
17
|
repo.apply_preset(session.id, params[:preset_id]) if params[:preset_id].present?
|
15
18
|
|
16
|
-
|
19
|
+
res.body = serialize(session)
|
17
20
|
rescue Sequel::ValidationFailed, Sequel::ForeignKeyConstraintViolation => e
|
18
|
-
|
19
|
-
self.status = 422
|
21
|
+
halt 422, { errors: e.message }.to_json
|
20
22
|
rescue StandardError => e
|
21
23
|
Application['logger'].error(e.full_message)
|
22
|
-
|
23
|
-
self.status = 500
|
24
|
+
halt 500, { errors: e.message }.to_json
|
24
25
|
end
|
25
26
|
|
26
27
|
def create_params(params)
|
@@ -3,12 +3,12 @@ module Inferno
|
|
3
3
|
module Controllers
|
4
4
|
module TestSessions
|
5
5
|
class LastTestRun < Controller
|
6
|
-
include Import[test_runs_repo: 'repositories.test_runs']
|
6
|
+
include Import[test_runs_repo: 'inferno.repositories.test_runs']
|
7
7
|
|
8
|
-
def
|
9
|
-
test_run = test_runs_repo.last_test_run(params[:
|
8
|
+
def handle(req, res)
|
9
|
+
test_run = test_runs_repo.last_test_run(req.params[:id])
|
10
10
|
|
11
|
-
|
11
|
+
res.body =
|
12
12
|
if test_run.nil?
|
13
13
|
nil
|
14
14
|
else
|
@@ -4,14 +4,14 @@ module Inferno
|
|
4
4
|
module TestSessions
|
5
5
|
module Results
|
6
6
|
class Index < Controller
|
7
|
-
include Import[test_sessions_repo: 'repositories.test_sessions']
|
7
|
+
include Import[test_sessions_repo: 'inferno.repositories.test_sessions']
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
if params[:all] == 'true'
|
12
|
-
serialize(test_sessions_repo.results_for_test_session(params[:
|
9
|
+
def handle(req, res)
|
10
|
+
res.body =
|
11
|
+
if req.params[:all] == 'true'
|
12
|
+
serialize(test_sessions_repo.results_for_test_session(req.params[:id]))
|
13
13
|
else
|
14
|
-
serialize(repo.current_results_for_test_session(params[:
|
14
|
+
serialize(repo.current_results_for_test_session(req.params[:id]))
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative '../../controller'
|
2
|
+
|
1
3
|
module Inferno
|
2
4
|
module Web
|
3
5
|
module Controllers
|
@@ -5,35 +7,33 @@ module Inferno
|
|
5
7
|
module SessionData
|
6
8
|
class ApplyPreset < Controller
|
7
9
|
include Import[
|
8
|
-
test_sessions_repo: 'repositories.test_sessions',
|
9
|
-
presets_repo: 'repositories.presets'
|
10
|
+
test_sessions_repo: 'inferno.repositories.test_sessions',
|
11
|
+
presets_repo: 'inferno.repositories.presets'
|
10
12
|
]
|
11
13
|
|
12
14
|
def self.resource_class
|
13
15
|
'SessionData'
|
14
16
|
end
|
15
17
|
|
16
|
-
def
|
17
|
-
test_session_id = params[:
|
18
|
+
def handle(req, res)
|
19
|
+
test_session_id = req.params[:id]
|
18
20
|
test_session = test_sessions_repo.find(test_session_id)
|
19
21
|
|
20
22
|
if test_session.nil?
|
21
23
|
Application[:logger].error("Unknown test session #{test_session_id}")
|
22
|
-
|
23
|
-
return
|
24
|
+
halt 404
|
24
25
|
end
|
25
26
|
|
26
|
-
preset_id = params[:preset_id]
|
27
|
+
preset_id = req.params[:preset_id]
|
27
28
|
preset = presets_repo.find(preset_id)
|
28
29
|
|
29
30
|
if preset.nil?
|
30
31
|
Application[:logger].error("Unknown preset #{preset_id}")
|
31
|
-
|
32
|
-
return
|
32
|
+
halt 404
|
33
33
|
end
|
34
34
|
|
35
35
|
test_sessions_repo.apply_preset(test_session_id, preset_id)
|
36
|
-
|
36
|
+
res.status = 200
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -1,17 +1,19 @@
|
|
1
|
+
require_relative '../../../serializers/session_data'
|
2
|
+
|
1
3
|
module Inferno
|
2
4
|
module Web
|
3
5
|
module Controllers
|
4
6
|
module TestSessions
|
5
7
|
module SessionData
|
6
8
|
class Index < Controller
|
7
|
-
include Import[session_data_repo: 'repositories.session_data']
|
9
|
+
include Import[session_data_repo: 'inferno.repositories.session_data']
|
8
10
|
|
9
11
|
def self.resource_class
|
10
12
|
'SessionData'
|
11
13
|
end
|
12
14
|
|
13
|
-
def
|
14
|
-
|
15
|
+
def handle(req, res)
|
16
|
+
res.body = serialize(session_data_repo.get_all_from_session(req.params[:id]))
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -3,11 +3,11 @@ module Inferno
|
|
3
3
|
module Controllers
|
4
4
|
module TestSessions
|
5
5
|
class Show < Controller
|
6
|
-
def
|
7
|
-
test_session = repo.find(params[:id])
|
6
|
+
def handle(req, res)
|
7
|
+
test_session = repo.find(req.params[:id])
|
8
8
|
halt 404 if test_session.nil?
|
9
9
|
|
10
|
-
|
10
|
+
res.body = serialize(test_session)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -3,11 +3,11 @@ module Inferno
|
|
3
3
|
module Controllers
|
4
4
|
module TestSuites
|
5
5
|
class CheckConfiguration < Controller
|
6
|
-
def
|
7
|
-
test_suite = repo.find(params[:id])
|
6
|
+
def handle(req, res)
|
7
|
+
test_suite = repo.find(req.params[:id])
|
8
8
|
halt 404 if test_suite.nil?
|
9
9
|
|
10
|
-
|
10
|
+
res.body =
|
11
11
|
Inferno::Web::Serializers::Message.render(test_suite.configuration_messages(force_recheck: true))
|
12
12
|
end
|
13
13
|
end
|
@@ -3,11 +3,11 @@ module Inferno
|
|
3
3
|
module Controllers
|
4
4
|
module TestSuites
|
5
5
|
class Show < Controller
|
6
|
-
def
|
7
|
-
test_suite = repo.find(params[:id])
|
6
|
+
def handle(req, res)
|
7
|
+
test_suite = repo.find(req.params[:id])
|
8
8
|
halt 404 if test_suite.nil?
|
9
9
|
|
10
|
-
|
10
|
+
res.body = serialize(test_suite, view: :full)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -1,62 +1,76 @@
|
|
1
1
|
require 'erb'
|
2
2
|
|
3
|
+
Dir.glob(File.join(__dir__, 'controllers', '**', '*.rb')).each { |path| require_relative path }
|
4
|
+
|
3
5
|
module Inferno
|
4
6
|
module Web
|
5
7
|
client_page = ERB.new(File.read(File.join(Inferno::Application.root, 'lib', 'inferno', 'apps', 'web',
|
6
8
|
'index.html.erb'))).result
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
get '
|
10
|
+
base_path = Application['base_path']
|
11
|
+
base_path = "/#{base_path.delete_prefix('/')}" if base_path.present?
|
12
|
+
|
13
|
+
Router = Hanami::Router.new(prefix: base_path) do
|
14
|
+
scope 'api' do
|
15
|
+
scope 'test_runs' do
|
16
|
+
post '/', to: Inferno::Web::Controllers::TestRuns::Create, as: :create
|
17
|
+
get '/:id', to: Inferno::Web::Controllers::TestRuns::Show, as: :show
|
18
|
+
delete '/:id', to: Inferno::Web::Controllers::TestRuns::Destroy, as: :destroy
|
19
|
+
|
20
|
+
get '/results', to: Inferno::Web::Controllers::TestRuns::Results::Index, as: :results
|
21
|
+
end
|
22
|
+
|
23
|
+
scope 'test_sessions' do
|
24
|
+
post '/', to: Inferno::Web::Controllers::TestSessions::Create, as: :create
|
25
|
+
get '/:id', to: Inferno::Web::Controllers::TestSessions::Show, as: :show
|
26
|
+
|
27
|
+
get '/:id/last_test_run',
|
26
28
|
to: Inferno::Web::Controllers::TestSessions::LastTestRun,
|
27
29
|
as: :last_test_run
|
30
|
+
get '/:id/results',
|
31
|
+
to: Inferno::Web::Controllers::TestSessions::Results::Index,
|
32
|
+
as: :results
|
33
|
+
get '/:id/session_data',
|
34
|
+
to: Inferno::Web::Controllers::TestSessions::SessionData::Index
|
35
|
+
put '/:id/session_data/apply_preset',
|
36
|
+
to: Inferno::Web::Controllers::TestSessions::SessionData::ApplyPreset,
|
37
|
+
as: :session_data_apply_preset
|
38
|
+
end
|
28
39
|
|
29
|
-
|
30
|
-
|
40
|
+
scope 'test_suites' do
|
41
|
+
get '/', to: Inferno::Web::Controllers::TestSuites::Index, as: :index
|
42
|
+
get '/:id', to: Inferno::Web::Controllers::TestSuites::Show, as: :show
|
43
|
+
|
44
|
+
put '/:id/check_configuration',
|
31
45
|
to: Inferno::Web::Controllers::TestSuites::CheckConfiguration,
|
32
46
|
as: :check_configuration
|
47
|
+
end
|
33
48
|
|
34
|
-
|
49
|
+
get '/requests/:id', to: Inferno::Web::Controllers::Requests::Show, as: :requests_show
|
35
50
|
|
36
|
-
|
37
|
-
|
51
|
+
get '/version', to: ->(_env) { [200, {}, [{ 'version' => Inferno::VERSION.to_s }.to_json]] }, as: :version
|
52
|
+
end
|
38
53
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
Inferno.routes.each do |route|
|
45
|
-
cleaned_id = route[:suite].id.gsub(/[^a-zA-Z\d\-._~]/, '_')
|
46
|
-
path = "/custom/#{cleaned_id}#{route[:path]}"
|
47
|
-
Application['logger'].info("Registering custom route: #{path}")
|
48
|
-
if route[:method] == :all
|
49
|
-
mount route[:handler], at: path
|
50
|
-
else
|
51
|
-
send(route[:method], path, to: route[:handler])
|
52
|
-
end
|
53
|
-
end
|
54
|
+
# Should not need Content-Type header but GitHub Codespaces will not work without them.
|
55
|
+
# This could be investigated and likely removed if addressed properly elsewhere.
|
56
|
+
get '/', to: ->(_env) { [200, { 'Content-Type' => 'text/html' }, [client_page]] }
|
57
|
+
get '/test_sessions/:id', to: ->(_env) { [200, { 'Content-Type' => 'text/html' }, [client_page]] }
|
54
58
|
|
55
|
-
|
56
|
-
|
57
|
-
|
59
|
+
Inferno.routes.each do |route|
|
60
|
+
cleaned_id = route[:suite].id.gsub(/[^a-zA-Z\d\-._~]/, '_')
|
61
|
+
path = "/custom/#{cleaned_id}#{route[:path]}"
|
62
|
+
Application['logger'].info("Registering custom route: #{path}")
|
63
|
+
if route[:method] == :all
|
64
|
+
mount route[:handler], at: path
|
65
|
+
else
|
66
|
+
send(route[:method], path, to: route[:handler])
|
58
67
|
end
|
59
68
|
end
|
69
|
+
|
70
|
+
Inferno::Repositories::TestSuites.all.map { |suite| "/#{suite.id}" }.each do |suite_path|
|
71
|
+
Application['logger'].info("Registering suite route: #{suite_path}")
|
72
|
+
get suite_path, to: ->(_env) { [200, {}, [client_page]] }
|
73
|
+
end
|
60
74
|
end
|
61
75
|
end
|
62
76
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'serializer'
|
2
|
+
|
1
3
|
module Inferno
|
2
4
|
module Web
|
3
5
|
module Serializers
|
@@ -6,11 +8,6 @@ module Inferno
|
|
6
8
|
identifier :id
|
7
9
|
field :title
|
8
10
|
end
|
9
|
-
|
10
|
-
# view :full do
|
11
|
-
# include_view :summary
|
12
|
-
# field :inputs, blueprint: Input
|
13
|
-
# end
|
14
11
|
end
|
15
12
|
end
|
16
13
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative 'test'
|
2
|
+
|
1
3
|
module Inferno
|
2
4
|
module Web
|
3
5
|
module Serializers
|
@@ -19,11 +21,11 @@ module Inferno
|
|
19
21
|
end
|
20
22
|
field :test_groups do |group, options|
|
21
23
|
suite_options = options[:suite_options]
|
22
|
-
TestGroup.render_as_hash(group.groups(suite_options), suite_options:
|
24
|
+
TestGroup.render_as_hash(group.groups(suite_options), suite_options:)
|
23
25
|
end
|
24
26
|
field :tests do |group, options|
|
25
27
|
suite_options = options[:suite_options]
|
26
|
-
Test.render_as_hash(group.tests(suite_options), suite_options:
|
28
|
+
Test.render_as_hash(group.tests(suite_options), suite_options:)
|
27
29
|
end
|
28
30
|
field :inputs do |group, options|
|
29
31
|
suite_options = options[:suite_options]
|