test-prof-autopilot 0.1.0 → 0.2.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/README.md +1 -0
- data/lib/test_prof/autopilot/dsl.rb +4 -0
- data/lib/test_prof/autopilot/factory_default/printer.rb +25 -0
- data/lib/test_prof/autopilot/factory_default/profiling_executor.rb +28 -0
- data/lib/test_prof/autopilot/factory_default/report.rb +48 -0
- data/lib/test_prof/autopilot/factory_default/writer.rb +18 -0
- data/lib/test_prof/autopilot/factory_prof/printer.rb +1 -1
- data/lib/test_prof/autopilot/merger.rb +1 -1
- data/lib/test_prof/autopilot/patches/factory_default_patch.rb +43 -0
- data/lib/test_prof/autopilot/profiling_executor/base.rb +1 -0
- data/lib/test_prof/autopilot/stack_prof/report.rb +1 -1
- data/lib/test_prof/autopilot/version.rb +1 -1
- data/lib/test_prof/autopilot.rb +1 -0
- metadata +23 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b89cdc22563f224c6afcd3691936f579bcd8f842fd59bd9a0f82d940d52e15eb
|
4
|
+
data.tar.gz: 90658aba17f94b6daf47abb483b0be4338b3f5254d3ba9b49baf022cf4563314
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7c37e0297c79284184a91e1e57c735097bab4d51a9715f8c2bd1fb45275abd3fde694af3494b92162c2590520956d45c0d30a98f77558b3a7f727d48f50eeaf
|
7
|
+
data.tar.gz: c3d0f2aac5bc096a512fdd8bf00ac83e13dd2e482b815aee43237258bc1f9b6b36f6389cd7561729ee488a3bb43652081ddcbef804afd33362f2eb9e760e58f7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -85,6 +85,7 @@ Currently, Autopilot supports the following Test Prof profilers:
|
|
85
85
|
- [TagProf](https://test-prof.evilmartians.io/profilers/tag_prof) (as `:tag_prof`)
|
86
86
|
- [StackProf](https://test-prof.evilmartians.io/profilers/stack_prof) (as `:stack_prof`)
|
87
87
|
- [FactoryProf](https://test-prof.evilmartians.io/profilers/factory_prof) (as `:factory_prof`)
|
88
|
+
- [FactoryDefault profiler](https://test-prof.evilmartians.io/recipes/factory_default) (as `:factory_default_prof`)
|
88
89
|
|
89
90
|
## Installation
|
90
91
|
|
@@ -16,6 +16,10 @@ require "test_prof/autopilot/stack_prof/printer"
|
|
16
16
|
require "test_prof/autopilot/stack_prof/writer"
|
17
17
|
require "test_prof/autopilot/stack_prof/profiling_executor"
|
18
18
|
|
19
|
+
require "test_prof/autopilot/factory_default/printer"
|
20
|
+
require "test_prof/autopilot/factory_default/writer"
|
21
|
+
require "test_prof/autopilot/factory_default/profiling_executor"
|
22
|
+
|
19
23
|
module TestProf
|
20
24
|
module Autopilot
|
21
25
|
# Module contains all available DSL instructions
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TestProf
|
4
|
+
module Autopilot
|
5
|
+
module FactoryDefault
|
6
|
+
# Module is used for printing :factory_prof report
|
7
|
+
module Printer
|
8
|
+
Registry.register(:factory_default_prof_printer, self)
|
9
|
+
|
10
|
+
class PrinterError < StandardError; end
|
11
|
+
|
12
|
+
def print_report(report)
|
13
|
+
result = report.result
|
14
|
+
|
15
|
+
require "test_prof/factory_default"
|
16
|
+
profiler = TestProf::FactoryDefault::Profiler.new
|
17
|
+
profiler.data.merge!(result)
|
18
|
+
profiler.print_report
|
19
|
+
end
|
20
|
+
|
21
|
+
module_function :print_report
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "test_prof/autopilot/profiling_executor/base"
|
4
|
+
|
5
|
+
module TestProf
|
6
|
+
module Autopilot
|
7
|
+
module FactoryDefault
|
8
|
+
# Provides :factory_default_prof specific validations, env and command building.
|
9
|
+
class ProfilingExecutor < ProfilingExecutor::Base
|
10
|
+
Registry.register(:factory_default_prof_executor, self)
|
11
|
+
|
12
|
+
def initialize(options)
|
13
|
+
super
|
14
|
+
@profiler = :factory_default_prof
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def build_env
|
20
|
+
super.tap do |env|
|
21
|
+
env["FACTORY_DEFAULT_ENABLED"] = "true"
|
22
|
+
env["FACTORY_DEFAULT_PROF"] = "1"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "test_prof/autopilot/report_builder"
|
5
|
+
|
6
|
+
module TestProf
|
7
|
+
module Autopilot
|
8
|
+
module FactoryDefault
|
9
|
+
class Report
|
10
|
+
Registry.register(:factory_default_prof_report, self)
|
11
|
+
|
12
|
+
extend ReportBuilder
|
13
|
+
|
14
|
+
ARTIFACT_FILE = "factory_default_prof_report.json"
|
15
|
+
|
16
|
+
attr_reader :type, :raw_report
|
17
|
+
|
18
|
+
def initialize(raw_report)
|
19
|
+
@type = :factory_default_prof
|
20
|
+
@raw_report = raw_report
|
21
|
+
end
|
22
|
+
|
23
|
+
def result
|
24
|
+
@result ||= raw_report.tap { |r| r.transform_values! { |v| v.transform_keys!(&:to_sym) } }
|
25
|
+
end
|
26
|
+
|
27
|
+
def factories
|
28
|
+
result.dup
|
29
|
+
end
|
30
|
+
|
31
|
+
def merge(other)
|
32
|
+
report = result.dup
|
33
|
+
|
34
|
+
other.result.each do |name, stats|
|
35
|
+
if result.key?(name)
|
36
|
+
report[name][:count] += stats[:count]
|
37
|
+
report[name][:time] += stats[:time]
|
38
|
+
else
|
39
|
+
report[name] = stats
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
Report.new(report)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TestProf
|
4
|
+
module Autopilot
|
5
|
+
module FactoryDefault
|
6
|
+
# Class is used for writing :factory_prof report in different formats
|
7
|
+
class Writer < ReportWriter
|
8
|
+
Registry.register(:factory_default_prof_writer, self)
|
9
|
+
|
10
|
+
ARTIFACT_FILE = "factory_default_prof_report"
|
11
|
+
|
12
|
+
def generate_json
|
13
|
+
report.result.to_json
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -13,7 +13,7 @@ module TestProf
|
|
13
13
|
result = report.result
|
14
14
|
|
15
15
|
# TODO: Move total_time to the report
|
16
|
-
TestProf::FactoryProf::Printers::Simple.dump(result, start_time: TestProf.now)
|
16
|
+
TestProf::FactoryProf::Printers::Simple.dump(result, start_time: TestProf.now, threshold: 0)
|
17
17
|
end
|
18
18
|
|
19
19
|
module_function :print_report
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TestProf
|
4
|
+
module Autopilot
|
5
|
+
module Patches
|
6
|
+
module FactoryDefaultPatch
|
7
|
+
ARTIFACT_FILE = "factory_default_prof_report.json"
|
8
|
+
|
9
|
+
module ProfilerExt
|
10
|
+
def print_report
|
11
|
+
# TODO: extract it into a method in TestProf
|
12
|
+
data = self.data.each_with_object({}) do |(name, stats), acc|
|
13
|
+
name = name.gsub(/\$id\$.+\$di\$/, "<id>")
|
14
|
+
if acc.key?(name)
|
15
|
+
acc[name][:count] += stats[:count]
|
16
|
+
acc[name][:time] += stats[:time]
|
17
|
+
else
|
18
|
+
acc[name] = stats
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
dir_path = FileUtils.mkdir_p(Autopilot.config.tmp_dir)[0]
|
23
|
+
file_path = File.join(dir_path, ARTIFACT_FILE)
|
24
|
+
|
25
|
+
File.write(file_path, data.to_json)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def patch
|
30
|
+
::TestProf::FactoryDefault::Profiler.prepend(ProfilerExt)
|
31
|
+
end
|
32
|
+
|
33
|
+
module_function :patch
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
if ENV["FACTORY_DEFAULT_ENABLED"] == "true"
|
40
|
+
require "test_prof/factory_default"
|
41
|
+
require "test_prof/recipes/rspec/factory_default"
|
42
|
+
TestProf::Autopilot::Patches::FactoryDefaultPatch.patch
|
43
|
+
end
|
@@ -4,6 +4,7 @@ require "test_prof/autopilot/command_executor"
|
|
4
4
|
require "test_prof/autopilot/event_prof/report"
|
5
5
|
require "test_prof/autopilot/tag_prof/report"
|
6
6
|
require "test_prof/autopilot/factory_prof/report"
|
7
|
+
require "test_prof/autopilot/factory_default/report"
|
7
8
|
require "test_prof/autopilot/stack_prof/report"
|
8
9
|
|
9
10
|
module TestProf
|
data/lib/test_prof/autopilot.rb
CHANGED
@@ -9,5 +9,6 @@ if ENV["TEST_PROF_AUTOPILOT_ENABLED"] == "true"
|
|
9
9
|
require "test_prof/autopilot/patches/event_prof_patch"
|
10
10
|
require "test_prof/autopilot/patches/tag_prof_patch"
|
11
11
|
require "test_prof/autopilot/patches/factory_prof_patch"
|
12
|
+
require "test_prof/autopilot/patches/factory_default_patch"
|
12
13
|
require "test_prof/autopilot/patches/stack_prof_patch"
|
13
14
|
end
|
metadata
CHANGED
@@ -1,30 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-prof-autopilot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0.rc.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Shakirov
|
8
8
|
- Vladimir Dementyev
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-08-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-prof
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 1.3.100
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.5.0
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
|
-
- - "
|
28
|
+
- - ">"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 1.3.100
|
31
|
+
- - "<"
|
26
32
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
33
|
+
version: 1.5.0
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: bundler
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,6 +110,10 @@ files:
|
|
104
110
|
- lib/test_prof/autopilot/event_prof/profiling_executor.rb
|
105
111
|
- lib/test_prof/autopilot/event_prof/report.rb
|
106
112
|
- lib/test_prof/autopilot/event_prof/writer.rb
|
113
|
+
- lib/test_prof/autopilot/factory_default/printer.rb
|
114
|
+
- lib/test_prof/autopilot/factory_default/profiling_executor.rb
|
115
|
+
- lib/test_prof/autopilot/factory_default/report.rb
|
116
|
+
- lib/test_prof/autopilot/factory_default/writer.rb
|
107
117
|
- lib/test_prof/autopilot/factory_prof/printer.rb
|
108
118
|
- lib/test_prof/autopilot/factory_prof/profiling_executor.rb
|
109
119
|
- lib/test_prof/autopilot/factory_prof/report.rb
|
@@ -111,6 +121,7 @@ files:
|
|
111
121
|
- lib/test_prof/autopilot/logging.rb
|
112
122
|
- lib/test_prof/autopilot/merger.rb
|
113
123
|
- lib/test_prof/autopilot/patches/event_prof_patch.rb
|
124
|
+
- lib/test_prof/autopilot/patches/factory_default_patch.rb
|
114
125
|
- lib/test_prof/autopilot/patches/factory_prof_patch.rb
|
115
126
|
- lib/test_prof/autopilot/patches/stack_prof_patch.rb
|
116
127
|
- lib/test_prof/autopilot/patches/tag_prof_patch.rb
|
@@ -138,7 +149,7 @@ metadata:
|
|
138
149
|
homepage_uri: https://test-prof.evilmartians.io/
|
139
150
|
source_code_uri: https://github.com/test-prof/test-prof-autopilot
|
140
151
|
funding_uri: https://github.com/sponsors/test-prof
|
141
|
-
post_install_message:
|
152
|
+
post_install_message:
|
142
153
|
rdoc_options: []
|
143
154
|
require_paths:
|
144
155
|
- lib
|
@@ -149,12 +160,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
160
|
version: '2.7'
|
150
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
162
|
requirements:
|
152
|
-
- - "
|
163
|
+
- - ">"
|
153
164
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
165
|
+
version: 1.3.1
|
155
166
|
requirements: []
|
156
|
-
rubygems_version: 3.4.
|
157
|
-
signing_key:
|
167
|
+
rubygems_version: 3.4.19
|
168
|
+
signing_key:
|
158
169
|
specification_version: 4
|
159
170
|
summary: Automatic TestProf runner
|
160
171
|
test_files: []
|