inferno_core 0.0.3 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/bin/inferno +7 -0
  3. data/lib/inferno/apps/cli/console.rb +12 -0
  4. data/lib/inferno/apps/cli/main.rb +18 -0
  5. data/lib/inferno/apps/cli/migration.rb +14 -0
  6. data/lib/inferno/apps/cli.rb +8 -0
  7. data/lib/inferno/apps/web/controllers/test_runs/create.rb +30 -10
  8. data/lib/inferno/apps/web/controllers/test_runs/show.rb +10 -0
  9. data/lib/inferno/apps/web/controllers/test_sessions/create.rb +1 -0
  10. data/lib/inferno/apps/web/controllers/test_sessions/last_test_run.rb +22 -0
  11. data/lib/inferno/apps/web/controllers/test_sessions/results/index.rb +6 -1
  12. data/lib/inferno/apps/web/controllers/test_sessions/session_data/index.rb +21 -0
  13. data/lib/inferno/apps/web/router.rb +15 -0
  14. data/lib/inferno/apps/web/serializers/hash_value_extractor.rb +11 -0
  15. data/lib/inferno/apps/web/serializers/request.rb +1 -0
  16. data/lib/inferno/apps/web/serializers/result.rb +8 -0
  17. data/lib/inferno/apps/web/serializers/session_data.rb +10 -0
  18. data/lib/inferno/apps/web/serializers/test.rb +3 -6
  19. data/lib/inferno/apps/web/serializers/test_group.rb +5 -8
  20. data/lib/inferno/apps/web/serializers/test_run.rb +1 -0
  21. data/lib/inferno/apps/web/serializers/test_session.rb +1 -1
  22. data/lib/inferno/apps/web/serializers/test_suite.rb +1 -0
  23. data/lib/inferno/config/application.rb +8 -2
  24. data/lib/inferno/config/boot/db.rb +3 -2
  25. data/lib/inferno/config/boot/logging.rb +2 -0
  26. data/lib/inferno/config/boot/sidekiq.rb +11 -0
  27. data/lib/inferno/config/boot/suites.rb +4 -6
  28. data/lib/inferno/config/boot.rb +2 -0
  29. data/lib/inferno/db/migrations/001_create_initial_structure.rb +0 -21
  30. data/lib/inferno/db/migrations/002_add_wait_support.rb +7 -0
  31. data/lib/inferno/db/migrations/003_update_session_data.rb +18 -0
  32. data/lib/inferno/db/migrations/004_add_request_results_table.rb +9 -0
  33. data/lib/inferno/db/migrations/005_add_updated_at_index_to_results.rb +5 -0
  34. data/lib/inferno/db/schema.rb +154 -0
  35. data/lib/inferno/dsl/assertions.rb +85 -0
  36. data/lib/inferno/dsl/configurable.rb +126 -0
  37. data/lib/inferno/dsl/fhir_client.rb +8 -6
  38. data/lib/inferno/dsl/fhir_client_builder.rb +19 -3
  39. data/lib/inferno/dsl/fhir_validation.rb +1 -1
  40. data/lib/inferno/dsl/http_client.rb +14 -12
  41. data/lib/inferno/dsl/http_client_builder.rb +3 -3
  42. data/lib/inferno/dsl/request_storage.rb +34 -13
  43. data/lib/inferno/dsl/results.rb +49 -0
  44. data/lib/inferno/dsl/resume_test_route.rb +89 -0
  45. data/lib/inferno/dsl/runnable.rb +183 -28
  46. data/lib/inferno/dsl.rb +1 -3
  47. data/lib/inferno/entities/header.rb +14 -7
  48. data/lib/inferno/entities/message.rb +16 -6
  49. data/lib/inferno/entities/request.rb +59 -20
  50. data/lib/inferno/entities/result.rb +45 -22
  51. data/lib/inferno/entities/session_data.rb +39 -0
  52. data/lib/inferno/entities/test.rb +48 -8
  53. data/lib/inferno/entities/test_group.rb +8 -0
  54. data/lib/inferno/entities/test_run.rb +36 -6
  55. data/lib/inferno/entities/test_session.rb +17 -11
  56. data/lib/inferno/entities.rb +1 -1
  57. data/lib/inferno/exceptions.rb +24 -0
  58. data/lib/inferno/jobs/execute_test_run.rb +14 -0
  59. data/lib/inferno/jobs/resume_test_run.rb +14 -0
  60. data/lib/inferno/jobs.rb +16 -0
  61. data/lib/inferno/public/bundle.js +1 -1
  62. data/lib/inferno/repositories/in_memory_repository.rb +1 -1
  63. data/lib/inferno/repositories/repository.rb +13 -0
  64. data/lib/inferno/repositories/requests.rb +5 -4
  65. data/lib/inferno/repositories/results.rb +151 -3
  66. data/lib/inferno/repositories/session_data.rb +47 -0
  67. data/lib/inferno/repositories/test_runs.rb +81 -0
  68. data/lib/inferno/spec_support.rb +1 -1
  69. data/lib/inferno/test_runner.rb +126 -32
  70. data/lib/inferno/utils/markdown_formatter.rb +15 -0
  71. data/lib/inferno/utils/middleware/request_logger.rb +17 -4
  72. data/lib/inferno/utils/migration.rb +17 -0
  73. data/lib/inferno/version.rb +1 -1
  74. data/lib/inferno.rb +4 -4
  75. data/spec/factories/request.rb +14 -7
  76. data/spec/factories/result.rb +8 -0
  77. data/spec/factories/test_run.rb +2 -0
  78. metadata +84 -7
  79. data/bin/inferno-console +0 -8
  80. data/lib/inferno/dsl/fhir_manipulation.rb +0 -25
  81. data/lib/inferno/entities/test_input.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8655cec1d50119f35eb0072e3d65375a78d9233d60ea8ffe3f745c400b941d5
4
- data.tar.gz: c7f163bd24c8a5272c803587d9c87680b5b108a9b7f5cd777344ff15d762d4fb
3
+ metadata.gz: 86c8b0374d22ea35f07944360943d2a1240f8ef7365b97d625b32facde4a2eaa
4
+ data.tar.gz: '0258752a8738b7e9c1da7d9112d0ee4f15bac0a8c7b2acac5f9973bb35d8146c'
5
5
  SHA512:
6
- metadata.gz: 12573879f154dfd74c005aeb334c2dec65539345411bb3acfd959d0403fab4481cc5379c1ed28e9639bb09825ce8f2793883d6398da09a98fb8d00f145e11489
7
- data.tar.gz: cbf9464a7e571dcef1d6f8c304c3ceadd545eeb7a54be18ded1f58280b77e34a449242f21672bdd8fa400347f425821dfb6fb096be82147537c480dd9e15a7fe
6
+ metadata.gz: 76cd8133722b109ed66f9b79eea46279c177fdac68cfe9abea4d0e9caaa76b861e533909923a94121d17e15483be5254f8e36e67cf6abb6121bc12f1e37f5fd7
7
+ data.tar.gz: 9be9f363e78e653b33818a8e8eee7fc74474ec2ca019b715054b7926d7e5675c46b290e138c0ee020e586d91eecef2759ead3272b6087461af89afeb8fdd7e94
data/bin/inferno ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pry'
4
+ require_relative '../lib/inferno/config/application'
5
+ require_relative '../lib/inferno/apps/cli'
6
+
7
+ Inferno::CLI::Main.start
@@ -0,0 +1,12 @@
1
+ module Inferno
2
+ module CLI
3
+ class Console
4
+ def run
5
+ require_relative '../../../inferno'
6
+
7
+ Inferno::Application.finalize!
8
+ Pry.start
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ require_relative 'console'
2
+ require_relative 'migration'
3
+
4
+ module Inferno
5
+ module CLI
6
+ class Main < Thor
7
+ desc 'console', 'Start an interactive console session with Inferno'
8
+ def console
9
+ Console.new.run
10
+ end
11
+
12
+ desc 'migrate', 'Run database migrations'
13
+ def migrate
14
+ Migration.new.run
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ require_relative '../../utils/migration'
2
+
3
+ module Inferno
4
+ module CLI
5
+ class Migration
6
+ def run
7
+ Inferno::Application.start(:logging)
8
+ Inferno::Application['logger'].level = Logger::DEBUG
9
+
10
+ Utils::Migration.new.run
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ require 'thor'
2
+
3
+ require_relative 'cli/main'
4
+
5
+ module Inferno
6
+ module CLI
7
+ end
8
+ end
@@ -3,28 +3,48 @@ module Inferno
3
3
  module Controllers
4
4
  module TestRuns
5
5
  class Create < Controller
6
- include Import[test_sessions_repo: 'repositories.test_sessions']
6
+ include Import[
7
+ test_sessions_repo: 'repositories.test_sessions',
8
+ session_data_repo: 'repositories.session_data',
9
+ test_runs_repo: 'repositories.test_runs'
10
+ ]
7
11
 
8
12
  PARAMS = [:test_session_id, :test_suite_id, :test_group_id, :test_id].freeze
9
13
 
10
14
  def call(params)
11
- test_run = repo.create(create_params(params))
12
- inputs = (params[:inputs] || {}).each_with_object({}) do |input, new_inputs|
13
- new_inputs[input[:name].to_sym] = input[:value]
14
- end
15
+ test_session = test_sessions_repo.find(params[:test_session_id])
15
16
 
16
- test_session = test_sessions_repo.find(test_run.test_session_id)
17
17
  # if testsession.nil?
18
+ if test_runs_repo.active_test_run_for_session?(test_session.id)
19
+ self.status = 409
20
+ self.body = { error: 'Cannot run new test while another test run is in progress' }.to_json
21
+ return
22
+ end
23
+
24
+ test_run = repo.create(create_params(params).merge(status: 'queued'))
25
+ missing_inputs = test_run.runnable.missing_inputs(params[:inputs])
18
26
 
19
- TestRunner
20
- .new(test_session: test_session, test_run: test_run)
21
- .run(test_run.runnable, inputs)
27
+ raise Inferno::Exceptions::RequiredInputsNotFound, missing_inputs if missing_inputs.any?
28
+ raise Inferno::Exceptions::NotUserRunnableException unless test_run.runnable.user_runnable?
22
29
 
23
30
  self.body = serialize(test_run)
24
- rescue Sequel::ValidationFailed, Sequel::ForeignKeyConstraintViolation => e
31
+
32
+ params[:inputs]&.each do |input|
33
+ session_data_repo.save(
34
+ test_session_id: test_session.id,
35
+ name: input[:name],
36
+ value: input[:value]
37
+ )
38
+ end
39
+
40
+ Jobs.perform(Jobs::ExecuteTestRun, test_run.id)
41
+ rescue Sequel::ValidationFailed, Sequel::ForeignKeyConstraintViolation,
42
+ Inferno::Exceptions::RequiredInputsNotFound,
43
+ Inferno::Exceptions::NotUserRunnableException => e
25
44
  self.body = { errors: e.message }.to_json
26
45
  self.status = 422
27
46
  rescue StandardError => e
47
+ Application['logger'].error(e.full_message)
28
48
  self.body = { errors: e.message }.to_json
29
49
  self.status = 500
30
50
  end
@@ -7,6 +7,16 @@ module Inferno
7
7
  test_run = repo.find(params[:id])
8
8
  halt 404 if test_run.nil?
9
9
 
10
+ if params[:include_results] == 'true'
11
+ results_repo = Inferno::Repositories::Results.new
12
+ test_run.results =
13
+ if params[:after].present?
14
+ results_repo.test_run_results_after(test_run_id: test_run.id, after: Time.parse(params[:after]))
15
+ else
16
+ repo.results_for_test_run(test_run.id)
17
+ end
18
+ end
19
+
10
20
  self.body = serialize(test_run)
11
21
  end
12
22
  end
@@ -12,6 +12,7 @@ module Inferno
12
12
  self.body = { errors: e.message }.to_json
13
13
  self.status = 422
14
14
  rescue StandardError => e
15
+ Application['logger'].error(e.full_message)
15
16
  self.body = { errors: e.message }.to_json
16
17
  self.status = 500
17
18
  end
@@ -0,0 +1,22 @@
1
+ module Inferno
2
+ module Web
3
+ module Controllers
4
+ module TestSessions
5
+ class LastTestRun < Controller
6
+ include Import[test_runs_repo: 'repositories.test_runs']
7
+
8
+ def call(params)
9
+ test_run = test_runs_repo.last_test_run(params[:test_session_id])
10
+
11
+ self.body =
12
+ if test_run.nil?
13
+ nil
14
+ else
15
+ Inferno::Web::Serializers::TestRun.render(test_run)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -7,7 +7,12 @@ module Inferno
7
7
  include Import[test_sessions_repo: 'repositories.test_sessions']
8
8
 
9
9
  def call(params)
10
- self.body = serialize(test_sessions_repo.results_for_test_session(params[:test_session_id]))
10
+ self.body =
11
+ if params[:all] == 'true'
12
+ serialize(test_sessions_repo.results_for_test_session(params[:test_session_id]))
13
+ else
14
+ serialize(repo.current_results_for_test_session(params[:test_session_id]))
15
+ end
11
16
  end
12
17
  end
13
18
  end
@@ -0,0 +1,21 @@
1
+ module Inferno
2
+ module Web
3
+ module Controllers
4
+ module TestSessions
5
+ module SessionData
6
+ class Index < Controller
7
+ include Import[session_data_repo: 'repositories.session_data']
8
+
9
+ def self.resource_class
10
+ 'SessionData'
11
+ end
12
+
13
+ def call(params)
14
+ self.body = serialize(session_data_repo.get_all_from_session(params[:test_session_id]))
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -13,7 +13,11 @@ module Inferno
13
13
 
14
14
  resources 'test_sessions', only: [:create, :show] do
15
15
  resources 'results', only: [:index]
16
+ resources 'session_data', only: [:index]
16
17
  end
18
+ get 'test_sessions/:test_session_id/last_test_run',
19
+ to: Inferno::Web::Controllers::TestSessions::LastTestRun,
20
+ as: :last_test_run
17
21
 
18
22
  resources 'test_suites', only: [:index, :show]
19
23
 
@@ -22,6 +26,17 @@ module Inferno
22
26
 
23
27
  get '/', to: ->(_env) { [200, {}, [client_page]] }
24
28
  get '/test_sessions/:id', to: ->(_env) { [200, {}, [client_page]] }
29
+
30
+ Inferno.routes.each do |route|
31
+ cleaned_id = route[:suite].id.gsub(/[^a-zA-Z\d\-._~]/, '_')
32
+ path = "/custom/#{cleaned_id}#{route[:path]}"
33
+ Application['logger'].info("Registering custom route: #{path}")
34
+ if route[:method] == :all
35
+ mount route[:handler], at: path
36
+ else
37
+ send(route[:method], path, to: route[:handler])
38
+ end
39
+ end
25
40
  end
26
41
  end
27
42
  end
@@ -0,0 +1,11 @@
1
+ module Inferno
2
+ module Web
3
+ module Serializers
4
+ class HashValueExtractor < Blueprinter::Extractor
5
+ def extract(field_name, object, _local_options, _options)
6
+ object.send(field_name).values
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -9,6 +9,7 @@ module Inferno
9
9
  field :url
10
10
  field :direction
11
11
  field :status
12
+ field :result_id
12
13
  end
13
14
 
14
15
  view :full do
@@ -1,3 +1,5 @@
1
+ require 'json'
2
+
1
3
  module Inferno
2
4
  module Web
3
5
  module Serializers
@@ -12,6 +14,12 @@ module Inferno
12
14
  field :test_session_id
13
15
  field :result
14
16
  field :result_message, if: :field_present?
17
+ field :created_at
18
+ field :updated_at
19
+
20
+ field :outputs do |result, _options|
21
+ result.output_json.present? ? JSON.parse(result.output_json) : []
22
+ end
15
23
 
16
24
  association :messages, blueprint: Message, if: :field_present?
17
25
  association :requests, blueprint: Request, view: :summary, if: :field_present?
@@ -0,0 +1,10 @@
1
+ module Inferno
2
+ module Web
3
+ module Serializers
4
+ class SessionData < Serializer
5
+ field :name
6
+ field :value
7
+ end
8
+ end
9
+ end
10
+ end
@@ -4,13 +4,10 @@ module Inferno
4
4
  class Test < Serializer
5
5
  identifier :id
6
6
  field :title
7
- field :inputs do |test, _options|
8
- test.inputs.map { |input| { name: input } }
9
- end
10
- field :outputs do |test, _options|
11
- test.outputs.map { |output| { name: output } }
12
- end
7
+ field :input_definitions, name: :inputs, extractor: HashValueExtractor, blueprint: Input
8
+ field :output_definitions, name: :outputs, extractor: HashValueExtractor
13
9
  field :description
10
+ field :user_runnable?, name: :user_runnable
14
11
  end
15
12
  end
16
13
  end
@@ -4,19 +4,16 @@ module Inferno
4
4
  class TestGroup < Serializer
5
5
  identifier :id
6
6
 
7
- # TODO: fill out test group
8
7
  field :title
9
8
  field :description
10
- # field :run_as_group
9
+ field :test_count
10
+ field :run_as_group?, name: :run_as_group
11
+ field :user_runnable?, name: :user_runnable
11
12
 
12
13
  association :groups, name: :test_groups, blueprint: TestGroup
13
14
  association :tests, blueprint: Test
14
- field :inputs do |group, _options|
15
- group.inputs.map { |input| { name: input } }
16
- end
17
- field :outputs do |group, _options|
18
- group.outputs.map { |input| { name: input } }
19
- end
15
+ field :input_definitions, name: :inputs, extractor: HashValueExtractor, blueprint: Input
16
+ field :output_definitions, name: :outputs, extractor: HashValueExtractor
20
17
  end
21
18
  end
22
19
  end
@@ -6,6 +6,7 @@ module Inferno
6
6
  field :test_session_id
7
7
 
8
8
  field :status
9
+ field :test_count
9
10
 
10
11
  field :test_group_id, if: :field_present?
11
12
  field :test_suite_id, if: :field_present?
@@ -9,7 +9,7 @@ module Inferno
9
9
  field :test_suite_id
10
10
 
11
11
  association :test_suite, blueprint: TestSuite, view: :full
12
- # association :test_run, blueprint: TestRun
12
+ # association :test_runs, blueprint: TestRun
13
13
  # association :results, blueprint: Result
14
14
  end
15
15
  end
@@ -6,6 +6,7 @@ module Inferno
6
6
  identifier :id
7
7
  field :title
8
8
  field :description
9
+ field :test_count
9
10
  end
10
11
 
11
12
  view :full do
@@ -1,3 +1,7 @@
1
+ require 'active_support/all'
2
+ require 'dotenv'
3
+ require 'dry/system/container'
4
+ require 'sequel'
1
5
  require_relative 'boot'
2
6
 
3
7
  module Inferno
@@ -6,6 +10,10 @@ module Inferno
6
10
 
7
11
  use :env, inferrer: -> { ENV.fetch('APP_ENV', :development).to_sym }
8
12
 
13
+ Application.register('js_host', ENV.fetch('JS_HOST', ''))
14
+ Application.register('async_jobs', ENV['ASYNC_JOBS'] != 'false')
15
+ Application.register('inferno_host', ENV.fetch('INFERNO_HOST', 'http://localhost:4567'))
16
+
9
17
  configure do |config|
10
18
  config.root = File.expand_path('../../..', __dir__)
11
19
  config.default_namespace = 'inferno'
@@ -15,8 +23,6 @@ module Inferno
15
23
  config.auto_register = 'lib'
16
24
  end
17
25
 
18
- Application.register('js_host', ENV.fetch('JS_HOST', ''))
19
-
20
26
  load_paths!('lib')
21
27
  end
22
28
  end
@@ -1,3 +1,5 @@
1
+ require 'sequel'
2
+
1
3
  Inferno::Application.boot(:db) do
2
4
  init do
3
5
  use :logging
@@ -10,6 +12,7 @@ Inferno::Application.boot(:db) do
10
12
  config = YAML.load_file(config_path)[ENV['APP_ENV']]
11
13
  .merge(logger: Inferno::Application['logger'])
12
14
  connection = Sequel.connect(config)
15
+ connection.sql_log_level = :debug
13
16
 
14
17
  register('db.config', config)
15
18
  register('db.connection', connection)
@@ -17,7 +20,5 @@ Inferno::Application.boot(:db) do
17
20
 
18
21
  start do
19
22
  Sequel.extension :migration
20
- migration_path = File.join(Inferno::Application.root, 'lib', 'inferno', 'db', 'migrations')
21
- Sequel::Migrator.run(Inferno::Application['db.connection'], migration_path)
22
23
  end
23
24
  end
@@ -11,6 +11,8 @@ Inferno::Application.boot(:logging) do
11
11
  Logger.new($stdout)
12
12
  end
13
13
 
14
+ logger.level = Logger::INFO
15
+
14
16
  register('logger', logger)
15
17
  end
16
18
  end
@@ -0,0 +1,11 @@
1
+ require 'sidekiq'
2
+
3
+ Inferno::Application.boot(:sidekiq) do
4
+ init do
5
+ if Inferno::Application['async_jobs']
6
+ Sidekiq.configure_server do |config|
7
+ config.redis = { url: ENV.fetch('REDIS_URL', 'redis://127.0.0.1:6379/0') }
8
+ end
9
+ end
10
+ end
11
+ end
@@ -4,12 +4,10 @@ Inferno::Application.boot(:suites) do
4
4
 
5
5
  files_to_load = Dir.glob(File.join(Dir.pwd, 'lib', '*.rb'))
6
6
 
7
- if ENV['LOAD_DEV_SUITES'] == 'true'
8
- files_to_load.concat Dir.glob(File.join(Inferno::Application.root, 'dev_suites', '**', '*.rb'))
9
- end
10
-
11
- if ENV['LOAD_UI_SUITES'] == 'true'
12
- files_to_load.concat Dir.glob(File.join(Inferno::Application.root, 'ui_suites', '**', '*.rb'))
7
+ if ENV['LOAD_DEV_SUITES'].present?
8
+ ENV['LOAD_DEV_SUITES'].split(',').map(&:strip).reject(&:empty?).each do |suite|
9
+ files_to_load.concat Dir.glob(File.join(Inferno::Application.root, 'dev_suites', suite, '**', '*.rb'))
10
+ end
13
11
  end
14
12
 
15
13
  if ENV['APP_ENV'] == 'test'
@@ -1,3 +1,5 @@
1
+ require 'dotenv'
2
+
1
3
  ENV['APP_ENV'] ||= 'development'
2
4
 
3
5
  root_path = Dir.pwd
@@ -1,26 +1,5 @@
1
1
  Sequel.migration do
2
2
  change do
3
- #
4
- # NOT NEEDED BECUASE THEY ARE DEFINED WITHIN TEST SUITE.
5
- # MUST BE REFERENCED USING SOME KIND OF GLOBALLY UNIQUE KEY
6
- # THAT IS REPRESENTED AS A STRING
7
- #
8
-
9
- # create_table :test_suites do
10
- # end
11
-
12
- # create_table :test_groups do
13
- # end
14
-
15
- # create_table :tests do
16
- # end
17
-
18
- # create_table :test_inputs do
19
- # end
20
-
21
- # create_table :test_outputs do
22
- # end
23
-
24
3
  # A way for the test to signal that it requires some kind of action by the
25
4
  # app that is invoking the test (e.g. SMART Launch, perhaps mid-test manual verification)
26
5
  # create_table :test_prompts do
@@ -0,0 +1,7 @@
1
+ Sequel.migration do
2
+ change do
3
+ add_column :test_runs, :identifier, String, text: true
4
+ add_column :test_runs, :wait_timeout, DateTime
5
+ add_index :test_runs, [:status, :identifier, :wait_timeout, :updated_at], concurrently: true
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ Sequel.migration do
2
+ change do
3
+ drop_table :test_run_inputs
4
+ drop_table :result_inputs
5
+
6
+ set_column_type :session_data, :value, String, text: true
7
+ drop_index :session_data, [:test_session_id, :name], concurrently: true
8
+ add_index :session_data, [:test_session_id, :name], unique: true, concurrently: true
9
+ drop_index :session_data, :id, concurrently: true
10
+ add_index :session_data, :id, unique: true, concurrently: true
11
+
12
+ add_column :results, :input_json, String, text: true
13
+ add_column :results, :output_json, String, text: true
14
+ add_index :results, [:test_session_id, :test_id], concurrently: true
15
+ add_index :results, [:test_session_id, :test_group_id], concurrently: true
16
+ add_index :results, [:test_session_id, :test_suite_id], concurrently: true
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ Sequel.migration do
2
+ change do
3
+ create_table :requests_results do
4
+ # using results_id instead of result_id to avoid ambiguous column error
5
+ foreign_key :results_id, :results, index: true, type: String, null: false
6
+ foreign_key :requests_id, :requests, index: true, type: String, null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ Sequel.migration do
2
+ change do
3
+ add_index :results, [:test_run_id, :updated_at], concurrently: true
4
+ end
5
+ end