inferno_core 0.4.37.dev → 0.4.37

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccd64a44d96c18439d7d844bd6ec467d9eb0c23d5964b0928539fd70a0e806f0
4
- data.tar.gz: b72e0ac46e7aca9d496fe23f6b89537c4a5c2054acc20690e089dc17d3d2528d
3
+ metadata.gz: 5fad068333ba8fce867afba323937728da89231ded560129675318866059975a
4
+ data.tar.gz: d231cf80975b781b0584c5bb2b4677e1493eaba2fa6469ffca490e113d46ba08
5
5
  SHA512:
6
- metadata.gz: 33d89c3291db6f4bfaf92b704eb13177b961e49b2b5c9c358661e062bde12f0eb00f5ab55e91945e089a7d2d83a13002926153c53b75b30b1a18926b69791496
7
- data.tar.gz: b6878fd8a73f017dccf8f027ac1ddfb7811a122f287a55ea6fe393b7e4d5dd0f2885d4e55d1a540f6bd5ec723619af8c00bdb8d633fd3ce187f9dd0d63790a97
6
+ metadata.gz: 34c983546c7ea05443d9edde97e59d9c9dab2e1848271eefb4f888ff58cafc1219541de91634250ae4831162689cdd9e1e8f043735bc0fe6e495c86eb3a1bf41
7
+ data.tar.gz: 2208622633268affb624426a91f4d6b7feed45cd7eac97dbad7c750c22169d7c08c5297fa96f8be86d13785faccf9966ad328b700528bcce0d2b8c6ba9cf97d1
@@ -1,4 +1,4 @@
1
- require 'hanami/controller'
1
+ require_relative 'suite_endpoint'
2
2
 
3
3
  module Inferno
4
4
  module DSL
@@ -6,58 +6,47 @@ module Inferno
6
6
  # an incoming request.
7
7
  # @private
8
8
  # @see Inferno::DSL::Runnable#resume_test_route
9
- class ResumeTestRoute < Hanami::Action
10
- include Import[
11
- requests_repo: 'inferno.repositories.requests',
12
- results_repo: 'inferno.repositories.results',
13
- test_runs_repo: 'inferno.repositories.test_runs',
14
- tests_repo: 'inferno.repositories.tests'
15
- ]
16
-
17
- def self.call(...)
18
- new.call(...)
9
+ class ResumeTestRoute < SuiteEndpoint
10
+ # The incoming request
11
+ #
12
+ # @return [Inferno::Entities::Request]
13
+ def request
14
+ @request ||= Inferno::Entities::Request.from_hanami_request(req)
19
15
  end
20
16
 
21
17
  # @private
22
- def test_run_identifier_block
23
- self.class.singleton_class.instance_variable_get(:@test_run_identifier_block)
18
+ def test_run_identifier
19
+ @test_run_identifier ||= instance_exec(request, &test_run_identifier_block)
24
20
  end
25
21
 
26
22
  # @private
27
23
  def tags
28
- self.class.singleton_class.instance_variable_get(:@tags)
24
+ self.class.singleton_class.instance_variable_get(:@tags) || []
29
25
  end
30
26
 
31
27
  # @private
32
- def result
33
- self.class.singleton_class.instance_variable_get(:@result)
28
+ def update_result
29
+ results_repo.update_result(result.id, new_result)
34
30
  end
35
31
 
36
32
  # @private
37
- def find_test_run(test_run_identifier)
38
- test_runs_repo.find_latest_waiting_by_identifier(test_run_identifier)
33
+ def make_response
34
+ res.redirect_to redirect_route(test_run, test)
39
35
  end
40
36
 
41
37
  # @private
42
- def find_waiting_result(test_run)
43
- results_repo.find_waiting_result(test_run_id: test_run.id)
38
+ def name
39
+ test.config.request_name(test.incoming_request_name)
44
40
  end
45
41
 
46
42
  # @private
47
- def update_result(waiting_result)
48
- results_repo.update_result(waiting_result.id, result)
43
+ def test_run_identifier_block
44
+ self.class.singleton_class.instance_variable_get(:@test_run_identifier_block)
49
45
  end
50
46
 
51
47
  # @private
52
- def persist_request(request, test_run, waiting_result, test)
53
- requests_repo.create(
54
- request.to_hash.merge(
55
- test_session_id: test_run.test_session_id,
56
- result_id: waiting_result.id,
57
- name: test.config.request_name(test.incoming_request_name),
58
- tags:
59
- )
60
- )
48
+ def new_result
49
+ self.class.singleton_class.instance_variable_get(:@new_result)
61
50
  end
62
51
 
63
52
  # @private
@@ -65,38 +54,10 @@ module Inferno
65
54
  "#{Application['base_url']}/test_sessions/#{test_run.test_session_id}##{resume_ui_at_id(test_run, test)}"
66
55
  end
67
56
 
68
- # @private
69
- def find_test(waiting_result)
70
- tests_repo.find(waiting_result.test_id)
71
- end
72
-
73
57
  # @private
74
58
  def resume_ui_at_id(test_run, test)
75
59
  test_run.test_suite_id || test_run.test_group_id || test.parent.id
76
60
  end
77
-
78
- # @private
79
- def handle(req, res)
80
- request = Inferno::Entities::Request.from_hanami_request(req)
81
-
82
- test_run_identifier = instance_exec(request, &test_run_identifier_block)
83
-
84
- test_run = find_test_run(test_run_identifier)
85
-
86
- halt 500, "Unable to find test run with identifier '#{test_run_identifier}'." if test_run.nil?
87
-
88
- test_runs_repo.mark_as_no_longer_waiting(test_run.id)
89
-
90
- waiting_result = find_waiting_result(test_run)
91
- test = find_test(waiting_result)
92
-
93
- update_result(waiting_result)
94
- persist_request(request, test_run, waiting_result, test)
95
-
96
- Jobs.perform(Jobs::ResumeTestRun, test_run.id)
97
-
98
- res.redirect_to redirect_route(test_run, test)
99
- end
100
61
  end
101
62
  end
102
63
  end
@@ -343,7 +343,7 @@ module Inferno
343
343
  route_class = Class.new(ResumeTestRoute) do |klass|
344
344
  klass.singleton_class.instance_variable_set(:@test_run_identifier_block, block)
345
345
  klass.singleton_class.instance_variable_set(:@tags, tags)
346
- klass.singleton_class.instance_variable_set(:@result, result)
346
+ klass.singleton_class.instance_variable_set(:@new_result, result)
347
347
  end
348
348
 
349
349
  route(method, path, route_class)
@@ -1,4 +1,4 @@
1
1
  module Inferno
2
2
  # Standard patterns for gem versions: https://guides.rubygems.org/patterns/
3
- VERSION = '0.4.37.dev'.freeze
3
+ VERSION = '0.4.37'.freeze
4
4
  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.4.37.dev
4
+ version: 0.4.37
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: 2024-05-18 00:00:00.000000000 Z
13
+ date: 2024-05-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -755,7 +755,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
755
755
  - !ruby/object:Gem::Version
756
756
  version: '0'
757
757
  requirements: []
758
- rubygems_version: 3.5.9
758
+ rubygems_version: 3.3.7
759
759
  signing_key:
760
760
  specification_version: 4
761
761
  summary: Inferno Core is an open source tool for testing data exchanges enabled by