inferno_core 0.1.1 → 0.1.3.pre2

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.
@@ -19,7 +19,7 @@ object-assign
19
19
  * @license MIT
20
20
  */
21
21
 
22
- /** @license MUI v5.2.0
22
+ /** @license MUI v5.3.0
23
23
  *
24
24
  * This source code is licensed under the MIT license found in the
25
25
  * LICENSE file in the root directory of this source tree.
@@ -140,6 +140,10 @@ module Inferno
140
140
  update(result_id, result: 'pass', result_message: message)
141
141
  end
142
142
 
143
+ def cancel_waiting_result(result_id, message = nil)
144
+ update(result_id, result: 'cancel', result_message: message)
145
+ end
146
+
143
147
  def json_serializer_options
144
148
  {
145
149
  include: {
@@ -27,7 +27,7 @@ module Inferno
27
27
 
28
28
  case type.to_s
29
29
  when 'oauth_credentials'
30
- DSL::OAuthCredentials.new(JSON.parse(raw_value))
30
+ DSL::OAuthCredentials.new(JSON.parse(raw_value || '{}'))
31
31
  else
32
32
  raw_value
33
33
  end
@@ -65,6 +65,10 @@ module Inferno
65
65
  build_entity(test_run_hash)
66
66
  end
67
67
 
68
+ def status_for_test_run(id)
69
+ self.class::Model.where(id: id).get(:status)
70
+ end
71
+
68
72
  def mark_as_running(test_run_id)
69
73
  update(test_run_id, status: 'running')
70
74
  end
@@ -91,6 +95,10 @@ module Inferno
91
95
  )
92
96
  end
93
97
 
98
+ def mark_as_cancelling(test_run_id)
99
+ update(test_run_id, status: 'cancelling')
100
+ end
101
+
94
102
  class Model < Sequel::Model(db)
95
103
  include ValidateRunnableReference
96
104
 
@@ -29,8 +29,13 @@ module Inferno
29
29
  @session_data_repo ||= Repositories::SessionData.new
30
30
  end
31
31
 
32
+ def test_run_is_cancelling
33
+ # forces db refetch of the test run status in case it is being cancelled
34
+ test_runs_repo.status_for_test_run(test_run.id) == 'cancelling'
35
+ end
36
+
32
37
  def start
33
- test_runs_repo.mark_as_running(test_run.id)
38
+ test_runs_repo.mark_as_running(test_run.id) unless test_run.status == 'cancelling'
34
39
 
35
40
  run(test_run.runnable)
36
41
 
@@ -60,6 +65,8 @@ module Inferno
60
65
  test_instance = test.new(inputs: inputs, test_session_id: test_session.id, scratch: scratch)
61
66
 
62
67
  result = begin
68
+ raise Exceptions::CancelException, 'Test cancelled by user' if test_run_is_cancelling
69
+
63
70
  test_instance.load_named_requests
64
71
  test_instance.instance_eval(&test.block)
65
72
  'pass'
@@ -1,3 +1,3 @@
1
1
  module Inferno
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.3.pre2'.freeze
3
3
  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.1.1
4
+ version: 0.1.3.pre2
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: 2022-01-25 00:00:00.000000000 Z
13
+ date: 2022-02-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -242,14 +242,14 @@ dependencies:
242
242
  requirements:
243
243
  - - "~>"
244
244
  - !ruby/object:Gem::Version
245
- version: 6.2.1
245
+ version: 6.4.0
246
246
  type: :runtime
247
247
  prerelease: false
248
248
  version_requirements: !ruby/object:Gem::Requirement
249
249
  requirements:
250
250
  - - "~>"
251
251
  - !ruby/object:Gem::Version
252
- version: 6.2.1
252
+ version: 6.4.0
253
253
  - !ruby/object:Gem::Dependency
254
254
  name: sqlite3
255
255
  requirement: !ruby/object:Gem::Requirement
@@ -466,6 +466,7 @@ files:
466
466
  - lib/inferno/apps/web/controllers/controller.rb
467
467
  - lib/inferno/apps/web/controllers/requests/show.rb
468
468
  - lib/inferno/apps/web/controllers/test_runs/create.rb
469
+ - lib/inferno/apps/web/controllers/test_runs/destroy.rb
469
470
  - lib/inferno/apps/web/controllers/test_runs/results/index.rb
470
471
  - lib/inferno/apps/web/controllers/test_runs/show.rb
471
472
  - lib/inferno/apps/web/controllers/test_sessions/create.rb
@@ -537,6 +538,7 @@ files:
537
538
  - lib/inferno/jobs/execute_test_run.rb
538
539
  - lib/inferno/jobs/resume_test_run.rb
539
540
  - lib/inferno/public/217.bundle.js
541
+ - lib/inferno/public/72a5cd989e6aea904540824ec865a0f8.png
540
542
  - lib/inferno/public/assets.json
541
543
  - lib/inferno/public/bundle.js
542
544
  - lib/inferno/public/bundle.js.LICENSE.txt
@@ -593,9 +595,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
593
595
  version: 2.7.0
594
596
  required_rubygems_version: !ruby/object:Gem::Requirement
595
597
  requirements:
596
- - - ">="
598
+ - - ">"
597
599
  - !ruby/object:Gem::Version
598
- version: '0'
600
+ version: 1.3.1
599
601
  requirements: []
600
602
  rubygems_version: 3.1.6
601
603
  signing_key: