inferno_core 0.1.1 → 0.1.2.pre

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fe39c8c3dfc7f0f12192e065746ab203836ebf93a9f2f6a22a847d0d95fe0a2
4
- data.tar.gz: 9b10445ccde6d340c35b39450f2cebef2b589b4473b4fe9a9c36ced3c7b20630
3
+ metadata.gz: a39bd8f76f999212e451616afca215d50bd97c3051183a46356263b95b56ac0a
4
+ data.tar.gz: 18bd6bf1a642fd950dbab94337f361b44b3ae54f611a2e2ef15ca61a871ebdc7
5
5
  SHA512:
6
- metadata.gz: a64d50d36b4269fe2449b2e6a25947cd04a1fc963c7fb4ffdfb0bd417d304ec5a5149bdb5cd69bd761ab4471378d13b1dc60d8c961ba6f1729d739c3ad553337
7
- data.tar.gz: 18a78ac99ac8fe75f6d1715272d6be64c51ae930c1a40cf5453c8aaefcd460739b4b6d817a776576898ffba02df449f07fbd1c7fc3468302b5d7b62f3f64e766
6
+ metadata.gz: fada61163e6b55d0d9f4a49be0ad1712bf9d788f3e9dee12f65716f554de8df508620088d396bc672aeff2b6c19328f113d477a0ee8b45fd5faa8d48d81de90b
7
+ data.tar.gz: d56a9fde79962c0f8900b9e0cb4acb50f90d687621bd344c75266aebe6e4ec977c7719a3a8661de4969aa28f7c96bff3882e2e12af4edc86c1abba06006b6292
@@ -0,0 +1,39 @@
1
+ module Inferno
2
+ module Web
3
+ module Controllers
4
+ module TestRuns
5
+ class Destroy < Controller
6
+ include Import[
7
+ test_runs_repo: 'repositories.test_runs',
8
+ results_repo: 'repositories.results'
9
+ ]
10
+
11
+ def call(params)
12
+ test_run = test_runs_repo.find(params[:id])
13
+
14
+ if test_run.nil? || ['done', 'cancelling'].include?(test_run.status)
15
+ # If it doesn't exist, already finished, or currently being cancelled
16
+ self.status = 204
17
+ return
18
+ end
19
+
20
+ test_run_is_waiting = (test_run.status == 'waiting')
21
+ test_runs_repo.mark_as_cancelling(params[:id])
22
+
23
+ if test_run_is_waiting
24
+ waiting_result = results_repo.find_waiting_result(test_run_id: test_run.id)
25
+ results_repo.cancel_waiting_result(waiting_result.id, 'Test cancelled by user')
26
+ Jobs.perform(Jobs::ResumeTestRun, test_run.id)
27
+ end
28
+
29
+ self.status = 204
30
+ rescue StandardError => e
31
+ Application['logger'].error(e.full_message)
32
+ self.body = { errors: e.message }.to_json
33
+ self.status = 500
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -7,7 +7,7 @@ module Inferno
7
7
 
8
8
  Router = Hanami::Router.new(namespace: Inferno::Web::Controllers) do
9
9
  namespace 'api' do
10
- resources 'test_runs', only: [:create, :show] do
10
+ resources 'test_runs', only: [:create, :show, :destroy] do
11
11
  resources 'results', only: [:index]
12
12
  end
13
13
 
@@ -13,6 +13,10 @@ module Inferno
13
13
  return @config if new_configuration.blank?
14
14
 
15
15
  @config.apply(new_configuration)
16
+
17
+ children.each { |child| child.config(new_configuration) }
18
+
19
+ @config
16
20
  end
17
21
 
18
22
  # @private
@@ -32,7 +32,7 @@ module Inferno
32
32
  # @return [String, nil] identfier for a waiting `TestRun`
33
33
  # @!attribute wait_timeout
34
34
  class TestRun < Entity
35
- STATUS_OPTIONS = ['queued', 'running', 'waiting', 'done'].freeze
35
+ STATUS_OPTIONS = ['queued', 'running', 'waiting', 'cancelling', 'done'].freeze
36
36
  ATTRIBUTES = [
37
37
  :id,
38
38
  :test_session_id,