megatest 0.9.1 → 0.10.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/megatest/cli.rb +2 -2
- data/lib/megatest/config.rb +4 -1
- data/lib/megatest/executor.rb +1 -1
- data/lib/megatest/output.rb +15 -1
- data/lib/megatest/reporters.rb +21 -17
- data/lib/megatest/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7faf3a2246db60ac65637b81ebd4e9dcc89bcf92b632c5a1034b5871c149e79f
|
|
4
|
+
data.tar.gz: 2313f464b0e13b6b468461f971b439a1ef2531465bb21514b7bb8fd76aaa5098
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a1c9fd82548391e403aeb33ed7d6083546923e9d785a91772ba7b1d2290aec50303d0fceaff27a33442a13b4242995b84d130d72921bfabf41c098bc668b55a
|
|
7
|
+
data.tar.gz: 8f1bb1f7795c35dbd65698e6f979889f30f0ad96e3e768b340ea1484171f14cb11777135dab9d89972d772f18f27105b25b5699bb834afe15eb30bc976751e7d
|
data/CHANGELOG.md
CHANGED
data/lib/megatest/cli.rb
CHANGED
|
@@ -165,7 +165,7 @@ module Megatest
|
|
|
165
165
|
|
|
166
166
|
if @junit != false
|
|
167
167
|
junit_file = open_file(@junit || "log/junit.xml")
|
|
168
|
-
reporters << Reporters::JUnitReporter.new(@config, Megatest::Output.new(junit_file, colors: true))
|
|
168
|
+
reporters << Reporters::JUnitReporter.new(@config, Megatest::Output.new(@config, junit_file, colors: true))
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
reporters
|
|
@@ -181,7 +181,7 @@ module Megatest
|
|
|
181
181
|
end
|
|
182
182
|
|
|
183
183
|
def bisect_queue(queue, failing_test_id)
|
|
184
|
-
err = Output.new(@err)
|
|
184
|
+
err = Output.new(@config, @err)
|
|
185
185
|
tests = queue.to_a
|
|
186
186
|
failing_test_index = tests.index { |test| test.id == failing_test_id }
|
|
187
187
|
failing_test = tests[failing_test_index]
|
data/lib/megatest/config.rb
CHANGED
|
@@ -67,6 +67,7 @@ module Megatest
|
|
|
67
67
|
config.build_id = env["BUILDKITE_BUILD_ID"]
|
|
68
68
|
config.worker_id = env["BUILDKITE_PARALLEL_JOB"]
|
|
69
69
|
config.workers_count = env["BUILDKITE_PARALLEL_JOB_COUNT"]
|
|
70
|
+
config.output_profile = :buildkite
|
|
70
71
|
config.seed = env["BUILDKITE_COMMIT"]&.first(4)&.to_i(16)
|
|
71
72
|
end
|
|
72
73
|
end
|
|
@@ -137,7 +138,8 @@ module Megatest
|
|
|
137
138
|
|
|
138
139
|
class Config
|
|
139
140
|
attr_accessor :queue_url, :retry_tolerance, :max_retries, :job_index, :load_paths, :deprecations,
|
|
140
|
-
:build_id, :heartbeat_frequency, :minitest_compatibility, :ci, :selectors
|
|
141
|
+
:build_id, :heartbeat_frequency, :minitest_compatibility, :ci, :selectors,
|
|
142
|
+
:output_profile
|
|
141
143
|
attr_reader :before_fork_callbacks, :global_setup_callbacks, :backtrace, :circuit_breaker, :seed,
|
|
142
144
|
:worker_id, :workers_count, :test_globs
|
|
143
145
|
attr_writer :jobs_count, :differ, :pretty_printer, :program_name, :colors
|
|
@@ -169,6 +171,7 @@ module Megatest
|
|
|
169
171
|
@minitest_compatibility = false
|
|
170
172
|
@selectors = nil
|
|
171
173
|
@test_globs = [DEFAULT_TEST_GLOB]
|
|
174
|
+
@output_profile = nil
|
|
172
175
|
CIService.configure(self, env)
|
|
173
176
|
end
|
|
174
177
|
|
data/lib/megatest/executor.rb
CHANGED
data/lib/megatest/output.rb
CHANGED
|
@@ -70,9 +70,10 @@ module Megatest
|
|
|
70
70
|
|
|
71
71
|
attr_reader :color
|
|
72
72
|
|
|
73
|
-
def initialize(io, colors: nil)
|
|
73
|
+
def initialize(config, io, colors: nil)
|
|
74
74
|
raise ArgumentError, "don't nest outputs" if io.is_a?(Output)
|
|
75
75
|
|
|
76
|
+
@config = config
|
|
76
77
|
@io = io
|
|
77
78
|
colors = io.tty? if colors.nil?
|
|
78
79
|
case colors
|
|
@@ -119,6 +120,19 @@ module Megatest
|
|
|
119
120
|
@io.print(*args)
|
|
120
121
|
end
|
|
121
122
|
|
|
123
|
+
def step(title, open: false)
|
|
124
|
+
case @config.output_profile
|
|
125
|
+
when :buildkite
|
|
126
|
+
if open
|
|
127
|
+
puts("+++ #{title}")
|
|
128
|
+
else
|
|
129
|
+
puts("--- #{title}")
|
|
130
|
+
end
|
|
131
|
+
else
|
|
132
|
+
puts("* #{title}")
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
122
136
|
def <<(str)
|
|
123
137
|
@io << str
|
|
124
138
|
end
|
data/lib/megatest/reporters.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Megatest
|
|
|
9
9
|
|
|
10
10
|
def initialize(config, out)
|
|
11
11
|
@config = config
|
|
12
|
-
@out = Output.new(out, colors: config.colors(out))
|
|
12
|
+
@out = Output.new(config, out, colors: config.colors(out))
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def start(_executor, _queue)
|
|
@@ -71,9 +71,9 @@ module Megatest
|
|
|
71
71
|
|
|
72
72
|
class SimpleReporter < AbstractReporter
|
|
73
73
|
def start(_executor, queue)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
@out.
|
|
74
|
+
title = "Running #{queue.size} test cases with --seed #{@config.seed}"
|
|
75
|
+
title += " in #{@config.jobs_count} processes" if @config.jobs_count > 1
|
|
76
|
+
@out.step(title)
|
|
77
77
|
@out.puts
|
|
78
78
|
end
|
|
79
79
|
|
|
@@ -96,6 +96,19 @@ module Megatest
|
|
|
96
96
|
@out.puts
|
|
97
97
|
|
|
98
98
|
failures = summary.failures.reject(&:skipped?)
|
|
99
|
+
|
|
100
|
+
summary_title = format(
|
|
101
|
+
"Ran %d cases, %d assertions, %d failures, %d errors, %d retries, %d skips",
|
|
102
|
+
summary.runs_count,
|
|
103
|
+
summary.assertions_count,
|
|
104
|
+
summary.failures_count,
|
|
105
|
+
summary.errors_count,
|
|
106
|
+
summary.retries_count,
|
|
107
|
+
summary.skips_count,
|
|
108
|
+
)
|
|
109
|
+
summary_title += " in #{@config.jobs_count} processes" if @config.jobs_count > 1
|
|
110
|
+
@out.step(summary_title, open: !failures.empty?)
|
|
111
|
+
|
|
99
112
|
unless failures.empty?
|
|
100
113
|
failures = failures.sort_by(&:test_id)
|
|
101
114
|
failures.each_with_index do |result, index|
|
|
@@ -115,9 +128,11 @@ module Megatest
|
|
|
115
128
|
p90 = sorted_results[(size * 0.9).to_i].duration
|
|
116
129
|
p99 = sorted_results[(size * 0.99).to_i].duration
|
|
117
130
|
|
|
118
|
-
@out.puts "Finished in #{s(executor.wall_time.to_f)}, average: #{ms(average)}, median: #{ms(median)}, p90: #{ms(p90)}, p99: #{ms(p99)}"
|
|
119
131
|
cutoff = p90 * 10
|
|
120
132
|
slowest_tests = sorted_results.last(5).select { |r| r.duration > cutoff }
|
|
133
|
+
|
|
134
|
+
stats = "Finished in #{s(executor.wall_time.to_f)}, average: #{ms(average)}, median: #{ms(median)}, p90: #{ms(p90)}, p99: #{ms(p99)}"
|
|
135
|
+
@out.step(stats, open: !slowest_tests.empty?)
|
|
121
136
|
unless slowest_tests.empty?
|
|
122
137
|
@out.puts "Slowest tests:"
|
|
123
138
|
slowest_tests.reverse_each do |result|
|
|
@@ -127,18 +142,6 @@ module Megatest
|
|
|
127
142
|
@out.puts ""
|
|
128
143
|
end
|
|
129
144
|
end
|
|
130
|
-
|
|
131
|
-
@out.print format(
|
|
132
|
-
"Ran %d cases, %d assertions, %d failures, %d errors, %d retries, %d skips",
|
|
133
|
-
summary.runs_count,
|
|
134
|
-
summary.assertions_count,
|
|
135
|
-
summary.failures_count,
|
|
136
|
-
summary.errors_count,
|
|
137
|
-
summary.retries_count,
|
|
138
|
-
summary.skips_count,
|
|
139
|
-
)
|
|
140
|
-
@out.print(" in #{@config.jobs_count} processes") if @config.jobs_count > 1
|
|
141
|
-
@out.puts
|
|
142
145
|
end
|
|
143
146
|
|
|
144
147
|
def s(duration)
|
|
@@ -153,6 +156,7 @@ module Megatest
|
|
|
153
156
|
class VerboseReporter < SimpleReporter
|
|
154
157
|
def start(executor, _queue)
|
|
155
158
|
@concurrent = executor.concurrent?
|
|
159
|
+
super
|
|
156
160
|
end
|
|
157
161
|
|
|
158
162
|
def before_test_case(_queue, test_case)
|
data/lib/megatest/version.rb
CHANGED