inferno_core 0.1.3 → 0.2.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inferno/apps/cli/main.rb +10 -0
- data/lib/inferno/apps/cli/suite.rb +19 -0
- data/lib/inferno/apps/cli/suite_input_template.rb +30 -0
- data/lib/inferno/apps/cli/suites.rb +23 -0
- data/lib/inferno/apps/web/controllers/test_sessions/create.rb +5 -2
- data/lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb +43 -0
- data/lib/inferno/apps/web/controllers/test_suites/check_configuration.rb +17 -0
- data/lib/inferno/apps/web/index.html.erb +5 -5
- data/lib/inferno/apps/web/router.rb +38 -25
- data/lib/inferno/apps/web/serializers/preset.rb +17 -0
- data/lib/inferno/apps/web/serializers/test.rb +2 -0
- data/lib/inferno/apps/web/serializers/test_group.rb +1 -0
- data/lib/inferno/apps/web/serializers/test_suite.rb +3 -0
- data/lib/inferno/config/application.rb +10 -1
- data/lib/inferno/config/boot/db.rb +16 -1
- data/lib/inferno/config/boot/presets.rb +15 -0
- data/lib/inferno/db/schema.rb +22 -22
- data/lib/inferno/dsl/resume_test_route.rb +1 -1
- data/lib/inferno/dsl/runnable.rb +18 -0
- data/lib/inferno/entities/preset.rb +24 -0
- data/lib/inferno/entities/test.rb +8 -0
- data/lib/inferno/entities/test_group.rb +8 -0
- data/lib/inferno/entities/test_suite.rb +31 -0
- data/lib/inferno/public/bundle.js +38 -38
- data/lib/inferno/repositories/in_memory_repository.rb +3 -2
- data/lib/inferno/repositories/presets.rb +22 -0
- data/lib/inferno/repositories/test_sessions.rb +12 -1
- data/lib/inferno/utils/preset_template_generator.rb +38 -0
- data/lib/inferno/utils/static_assets.rb +33 -0
- data/lib/inferno/version.rb +1 -1
- data/lib/inferno.rb +7 -6
- metadata +22 -11
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative 'in_memory_repository'
|
2
|
+
require_relative '../entities/preset'
|
3
|
+
|
4
|
+
module Inferno
|
5
|
+
module Repositories
|
6
|
+
# Repository that deals with persistence for the `Preset` entity.
|
7
|
+
class Presets < InMemoryRepository
|
8
|
+
def insert_from_file(path)
|
9
|
+
preset_hash = JSON.parse(File.read(path))
|
10
|
+
preset_hash.deep_symbolize_keys!
|
11
|
+
preset_hash[:id] ||= SecureRandom.uuid
|
12
|
+
preset = Entities::Preset.new(preset_hash)
|
13
|
+
|
14
|
+
insert(preset)
|
15
|
+
end
|
16
|
+
|
17
|
+
def presets_for_suite(suite_id)
|
18
|
+
all.select { |preset| preset.test_suite_id.to_s == suite_id.to_s }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -4,7 +4,11 @@ module Inferno
|
|
4
4
|
module Repositories
|
5
5
|
# Repository that deals with persistence for the `TestSession` entity.
|
6
6
|
class TestSessions < Repository
|
7
|
-
include Import[
|
7
|
+
include Import[
|
8
|
+
results_repo: 'repositories.results',
|
9
|
+
session_data_repo: 'repositories.session_data',
|
10
|
+
presets_repo: 'repositories.presets'
|
11
|
+
]
|
8
12
|
|
9
13
|
def json_serializer_options
|
10
14
|
{
|
@@ -26,6 +30,13 @@ module Inferno
|
|
26
30
|
.map! { |result| results_repo.build_entity(result) }
|
27
31
|
end
|
28
32
|
|
33
|
+
def apply_preset(test_session_id, preset_id)
|
34
|
+
preset = presets_repo.find(preset_id)
|
35
|
+
preset.inputs.each do |input|
|
36
|
+
session_data_repo.save(input.merge(test_session_id: test_session_id))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
29
40
|
class Model < Sequel::Model(db)
|
30
41
|
include Import[test_suites_repo: 'repositories.test_suites']
|
31
42
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Inferno
|
2
|
+
module Utils
|
3
|
+
class PresetTemplateGenerator
|
4
|
+
attr_accessor :runnable
|
5
|
+
|
6
|
+
def initialize(runnable)
|
7
|
+
self.runnable = runnable
|
8
|
+
end
|
9
|
+
|
10
|
+
def input_definitions
|
11
|
+
@input_definitions ||= runnable.available_input_definitions
|
12
|
+
end
|
13
|
+
|
14
|
+
def inputs
|
15
|
+
# The rubocop rule is disabled because `each_value` returns the hash,
|
16
|
+
# while `values.each` will return the array of values. We want the array
|
17
|
+
# of values here.
|
18
|
+
input_definitions.values.each do |input_definition| # rubocop:disable Style/HashEachMethods
|
19
|
+
input_definition[:value] =
|
20
|
+
(input_definition.delete(:default) if input_definition.key? :default)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def metadata
|
25
|
+
{
|
26
|
+
title: "Preset for #{runnable.title}",
|
27
|
+
id: nil
|
28
|
+
}.merge(runnable.reference_hash)
|
29
|
+
end
|
30
|
+
|
31
|
+
def generate
|
32
|
+
metadata.merge(
|
33
|
+
inputs: inputs
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Inferno
|
2
|
+
module Utils
|
3
|
+
# @private
|
4
|
+
class StaticAssets
|
5
|
+
class << self
|
6
|
+
def static_assets_folder
|
7
|
+
@static_assets_folder ||=
|
8
|
+
File.expand_path(File.join(inferno_path, 'public'))
|
9
|
+
end
|
10
|
+
|
11
|
+
def base_path
|
12
|
+
@base_path ||= Application['base_path']
|
13
|
+
end
|
14
|
+
|
15
|
+
def public_path
|
16
|
+
@public_path ||= "/#{base_path}/public".gsub('//', '/')
|
17
|
+
end
|
18
|
+
|
19
|
+
def inferno_path
|
20
|
+
@inferno_path ||= File.expand_path(File.join(__dir__, '..'))
|
21
|
+
end
|
22
|
+
|
23
|
+
# A hash of urls => file_paths which will be served with `Rack::Static`
|
24
|
+
def static_assets_map
|
25
|
+
Dir.glob(File.join(static_assets_folder, '*'))
|
26
|
+
.each_with_object({}) do |filename, hash|
|
27
|
+
hash["#{public_path}/#{File.basename(filename)}"] = filename.delete_prefix(inferno_path)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/inferno/version.rb
CHANGED
data/lib/inferno.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
module Inferno
|
2
|
+
def self.routes
|
3
|
+
@routes ||= []
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
1
7
|
require_relative 'inferno/config/application'
|
2
8
|
require_relative 'inferno/dsl'
|
3
9
|
require_relative 'inferno/entities'
|
@@ -7,9 +13,4 @@ require_relative 'inferno/repositories'
|
|
7
13
|
require_relative 'inferno/spec_support'
|
8
14
|
require_relative 'inferno/test_runner'
|
9
15
|
require_relative 'inferno/version'
|
10
|
-
|
11
|
-
module Inferno
|
12
|
-
def self.routes
|
13
|
-
@routes ||= []
|
14
|
-
end
|
15
|
-
end
|
16
|
+
require_relative 'inferno/utils/static_assets'
|
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
|
+
version: 0.2.0.rc2
|
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-
|
13
|
+
date: 2022-03-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -156,16 +156,16 @@ dependencies:
|
|
156
156
|
name: oj
|
157
157
|
requirement: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
|
-
- -
|
159
|
+
- - '='
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
161
|
+
version: 3.11.0
|
162
162
|
type: :runtime
|
163
163
|
prerelease: false
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
|
-
- -
|
166
|
+
- - '='
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
168
|
+
version: 3.11.0
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
170
|
name: pry
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,14 +228,14 @@ dependencies:
|
|
228
228
|
requirements:
|
229
229
|
- - "~>"
|
230
230
|
- !ruby/object:Gem::Version
|
231
|
-
version:
|
231
|
+
version: 5.42.0
|
232
232
|
type: :runtime
|
233
233
|
prerelease: false
|
234
234
|
version_requirements: !ruby/object:Gem::Requirement
|
235
235
|
requirements:
|
236
236
|
- - "~>"
|
237
237
|
- !ruby/object:Gem::Version
|
238
|
-
version:
|
238
|
+
version: 5.42.0
|
239
239
|
- !ruby/object:Gem::Dependency
|
240
240
|
name: sidekiq
|
241
241
|
requirement: !ruby/object:Gem::Requirement
|
@@ -462,6 +462,9 @@ files:
|
|
462
462
|
- lib/inferno/apps/cli/console.rb
|
463
463
|
- lib/inferno/apps/cli/main.rb
|
464
464
|
- lib/inferno/apps/cli/migration.rb
|
465
|
+
- lib/inferno/apps/cli/suite.rb
|
466
|
+
- lib/inferno/apps/cli/suite_input_template.rb
|
467
|
+
- lib/inferno/apps/cli/suites.rb
|
465
468
|
- lib/inferno/apps/web/application.rb
|
466
469
|
- lib/inferno/apps/web/controllers/controller.rb
|
467
470
|
- lib/inferno/apps/web/controllers/requests/show.rb
|
@@ -472,8 +475,10 @@ files:
|
|
472
475
|
- lib/inferno/apps/web/controllers/test_sessions/create.rb
|
473
476
|
- lib/inferno/apps/web/controllers/test_sessions/last_test_run.rb
|
474
477
|
- lib/inferno/apps/web/controllers/test_sessions/results/index.rb
|
478
|
+
- lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
|
475
479
|
- lib/inferno/apps/web/controllers/test_sessions/session_data/index.rb
|
476
480
|
- lib/inferno/apps/web/controllers/test_sessions/show.rb
|
481
|
+
- lib/inferno/apps/web/controllers/test_suites/check_configuration.rb
|
477
482
|
- lib/inferno/apps/web/controllers/test_suites/index.rb
|
478
483
|
- lib/inferno/apps/web/controllers/test_suites/show.rb
|
479
484
|
- lib/inferno/apps/web/index.html.erb
|
@@ -482,6 +487,7 @@ files:
|
|
482
487
|
- lib/inferno/apps/web/serializers/header.rb
|
483
488
|
- lib/inferno/apps/web/serializers/input.rb
|
484
489
|
- lib/inferno/apps/web/serializers/message.rb
|
490
|
+
- lib/inferno/apps/web/serializers/preset.rb
|
485
491
|
- lib/inferno/apps/web/serializers/request.rb
|
486
492
|
- lib/inferno/apps/web/serializers/result.rb
|
487
493
|
- lib/inferno/apps/web/serializers/serializer.rb
|
@@ -495,6 +501,7 @@ files:
|
|
495
501
|
- lib/inferno/config/boot.rb
|
496
502
|
- lib/inferno/config/boot/db.rb
|
497
503
|
- lib/inferno/config/boot/logging.rb
|
504
|
+
- lib/inferno/config/boot/presets.rb
|
498
505
|
- lib/inferno/config/boot/sidekiq.rb
|
499
506
|
- lib/inferno/config/boot/suites.rb
|
500
507
|
- lib/inferno/config/boot/web.rb
|
@@ -524,6 +531,7 @@ files:
|
|
524
531
|
- lib/inferno/entities/has_runnable.rb
|
525
532
|
- lib/inferno/entities/header.rb
|
526
533
|
- lib/inferno/entities/message.rb
|
534
|
+
- lib/inferno/entities/preset.rb
|
527
535
|
- lib/inferno/entities/request.rb
|
528
536
|
- lib/inferno/entities/result.rb
|
529
537
|
- lib/inferno/entities/session_data.rb
|
@@ -550,6 +558,7 @@ files:
|
|
550
558
|
- lib/inferno/repositories/headers.rb
|
551
559
|
- lib/inferno/repositories/in_memory_repository.rb
|
552
560
|
- lib/inferno/repositories/messages.rb
|
561
|
+
- lib/inferno/repositories/presets.rb
|
553
562
|
- lib/inferno/repositories/repository.rb
|
554
563
|
- lib/inferno/repositories/requests.rb
|
555
564
|
- lib/inferno/repositories/results.rb
|
@@ -566,6 +575,8 @@ files:
|
|
566
575
|
- lib/inferno/utils/markdown_formatter.rb
|
567
576
|
- lib/inferno/utils/middleware/request_logger.rb
|
568
577
|
- lib/inferno/utils/migration.rb
|
578
|
+
- lib/inferno/utils/preset_template_generator.rb
|
579
|
+
- lib/inferno/utils/static_assets.rb
|
569
580
|
- lib/inferno/version.rb
|
570
581
|
- spec/factories/header.rb
|
571
582
|
- spec/factories/message.rb
|
@@ -578,7 +589,7 @@ files:
|
|
578
589
|
- spec/support/factory_bot.rb
|
579
590
|
homepage: https://github.com/inferno_community/inferno-core
|
580
591
|
licenses:
|
581
|
-
- Apache
|
592
|
+
- Apache-2.0
|
582
593
|
metadata:
|
583
594
|
homepage_uri: https://github.com/inferno_community/inferno-core
|
584
595
|
source_code_uri: https://github.com/inferno_community/inferno-core
|
@@ -595,9 +606,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
595
606
|
version: 2.7.0
|
596
607
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
597
608
|
requirements:
|
598
|
-
- - "
|
609
|
+
- - ">"
|
599
610
|
- !ruby/object:Gem::Version
|
600
|
-
version:
|
611
|
+
version: 1.3.1
|
601
612
|
requirements: []
|
602
613
|
rubygems_version: 3.1.6
|
603
614
|
signing_key:
|