flakey_spec_catcher 0.7.3 → 0.8.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/flakey_spec_catcher/cli_override.rb +8 -2
- data/lib/flakey_spec_catcher/runner.rb +15 -4
- data/lib/flakey_spec_catcher/user_config.rb +16 -2
- data/lib/flakey_spec_catcher/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 490fe80338b705ba14cc730170a926ea256fe326193e4def21c83530439dd57d
|
4
|
+
data.tar.gz: 71af0da84b8eb5425acc40a04995e4183063cc1ae97d7cc3e67de090b48a1cd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e86a9b981d7d4c444186a34bcbc4a9cef55a366e0323edf7cf3049ca52403c5b81b6ca0fa4f3a50b878c022879739e64cc381466e1a8c06d2da26751710fb42
|
7
|
+
data.tar.gz: 504487fd4cf113791412ac23d2f1f0e73204b6505b3961e890525bd7cd7d896346065c39594c39c14bdb30dc08a51145ad6e28d82a645a9690731e48a9794e5a
|
data/README.md
CHANGED
@@ -132,6 +132,7 @@ In some cases, certain environment variables can be configured:
|
|
132
132
|
`FSC_EXCLUDED_TAGS=':tag1 => enabled'.
|
133
133
|
Note: examples do not inherit the tags from their parent example groups or parent contexts.
|
134
134
|
|
135
|
+
- `FSC_OUTPUT_FILE`: Specify a relative path to a file to write the contents of re-runs
|
135
136
|
|
136
137
|
Any of these environment variables can be overriden in the commit message by adding the environment variable key and
|
137
138
|
usage/value according to the accepted values specified above.
|
@@ -152,7 +153,8 @@ FSC_USAGE_PATTERNS = '{ spec/ui => bundle exec rspec }, { spec/api => parallel_r
|
|
152
153
|
-t, --test=TEST_NAME Specify one or more specs in comma separated list
|
153
154
|
-u, --usage=USAGE Specify a re-run usage for the manual re-run
|
154
155
|
-r, --repeat=REPEAT_FACTOR Specify a repeat factor for the manual re-run(s)
|
155
|
-
-e
|
156
|
+
-e, --excluded-tags=EXCLUDED Specify tags to exclude in a comma separated list
|
157
|
+
-o, --output=PATH_TO_OUTPUT Direct all re-run output to a specific file
|
156
158
|
-v, --version Prints current flakey_spec_catcher_version
|
157
159
|
-h, --help Displays available flakey_spec_catcher cli overrides
|
158
160
|
```
|
@@ -8,6 +8,7 @@ module FlakeySpecCatcher
|
|
8
8
|
# Captures command line arguments for manual re-runs
|
9
9
|
class CliOverride
|
10
10
|
attr_reader :rerun_patterns, :rerun_usage, :repeat_factor, :enable_runs, :excluded_tags
|
11
|
+
attr_reader :output_file
|
11
12
|
|
12
13
|
def initialize
|
13
14
|
@enable_runs = true
|
@@ -17,7 +18,7 @@ module FlakeySpecCatcher
|
|
17
18
|
|
18
19
|
private
|
19
20
|
|
20
|
-
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
21
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/BlockLength
|
21
22
|
def parse_command_line_args
|
22
23
|
OptionParser.new do |opts|
|
23
24
|
opts.banner = 'Usage: flakey_spec_catcher [OPTIONS]'
|
@@ -47,6 +48,11 @@ module FlakeySpecCatcher
|
|
47
48
|
@excluded_tags = parse_tags(tags)
|
48
49
|
end
|
49
50
|
|
51
|
+
opts.on('-o', '--output=PATH_TO_OUTPUT',
|
52
|
+
'Direct all re-run output to a specific file') do |file|
|
53
|
+
@output_file = remove_formatter_quotes(file)
|
54
|
+
end
|
55
|
+
|
50
56
|
opts.on('-v', '--version', 'Prints current flakey_spec_catcher_version') do
|
51
57
|
puts "flakey_spec_catcher Version: #{FlakeySpecCatcher::VERSION}"
|
52
58
|
@enable_runs = false
|
@@ -58,7 +64,7 @@ module FlakeySpecCatcher
|
|
58
64
|
end
|
59
65
|
end.parse!
|
60
66
|
end
|
61
|
-
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
67
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/BlockLength
|
62
68
|
|
63
69
|
def remove_formatter_quotes(env_var)
|
64
70
|
env_var.tr('\'\"', '')
|
@@ -26,6 +26,7 @@ module FlakeySpecCatcher
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# Debug Methods
|
29
|
+
# rubocop:disable Metrics/AbcSize
|
29
30
|
def show_settings
|
30
31
|
puts 'Flakey Spec Catcher Settings:'
|
31
32
|
puts " Current Branch: #{@git_controller.branch}"
|
@@ -34,7 +35,11 @@ module FlakeySpecCatcher
|
|
34
35
|
puts " Base Sha: #{@git_controller.base_commit_sha}"
|
35
36
|
puts " Repeat factor: #{@user_config.repeat_factor}"
|
36
37
|
puts " Changed Specs Detected: #{@git_controller.changed_examples}"
|
38
|
+
return if @user_config.output_file == '/dev/null'
|
39
|
+
|
40
|
+
puts " Verbose Output Path: #{@user_config.output_file}"
|
37
41
|
end
|
42
|
+
# rubocop:enable Metrics/AbcSize
|
38
43
|
|
39
44
|
def rerun_preview
|
40
45
|
puts "\n********************************************"
|
@@ -50,11 +55,12 @@ module FlakeySpecCatcher
|
|
50
55
|
|
51
56
|
def run_specs
|
52
57
|
status = 0
|
53
|
-
@
|
54
|
-
@
|
58
|
+
@rerun_manager.rerun_capsules.sort.each do |capsule|
|
59
|
+
@user_config.repeat_factor.times do
|
55
60
|
iteration_status = handle_capsule_rerun(capsule)
|
56
61
|
status = [status, iteration_status].max
|
57
62
|
end
|
63
|
+
RSpec.reset
|
58
64
|
end
|
59
65
|
|
60
66
|
display_results(status)
|
@@ -73,14 +79,19 @@ module FlakeySpecCatcher
|
|
73
79
|
def invoke_rspec_runner(test)
|
74
80
|
configure_listener
|
75
81
|
# Pass in CLI options to suppress normal output, and only run the specified test
|
76
|
-
rspec_args = ['--out',
|
82
|
+
rspec_args = ['--out', @user_config.output_file, test]
|
77
83
|
return_status = RSpec::Core::Runner.run(rspec_args)
|
78
84
|
RSpec.clear_examples
|
79
85
|
return_status
|
80
86
|
end
|
81
87
|
|
82
88
|
def invoke_custom_rspec_runner(usage, testcase)
|
83
|
-
`#{usage} #{testcase}`
|
89
|
+
custom_usage_output = `#{usage} #{testcase}`
|
90
|
+
|
91
|
+
if @user_config.output_file != '/dev/null'
|
92
|
+
File.open(@user_config.output_file, 'a') { |f| f.puts custom_usage_output }
|
93
|
+
end
|
94
|
+
|
84
95
|
$?.exitstatus # rubocop:disable Style/SpecialGlobalVars
|
85
96
|
end
|
86
97
|
|
@@ -11,11 +11,11 @@ module FlakeySpecCatcher
|
|
11
11
|
attr_reader :repeat_factor, :ignore_files, :ignore_branches, :silent_mode
|
12
12
|
attr_reader :rerun_file_only, :rspec_usage_patterns, :excluded_tags
|
13
13
|
attr_reader :manual_rerun_patterns, :manual_rerun_usage
|
14
|
-
attr_reader :enable_runs
|
14
|
+
attr_reader :enable_runs, :output_file
|
15
15
|
|
16
16
|
USER_CONFIG_ENV_VARS = %w[FSC_REPEAT_FACTOR FSC_IGNORE_FILES FSC_IGNORE_BRANCHES
|
17
17
|
FSC_SILENT_MODE FSC_RERUN_FILE_ONLY FSC_USAGE_PATTERNS
|
18
|
-
FSC_EXCLUDED_TAGS].freeze
|
18
|
+
FSC_EXCLUDED_TAGS FSC_OUTPUT_FILE].freeze
|
19
19
|
|
20
20
|
def initialize(cli_override: CliOverride.new)
|
21
21
|
apply_env_var_settings
|
@@ -34,6 +34,7 @@ module FlakeySpecCatcher
|
|
34
34
|
@rerun_file_only = env_var_string_to_bool(ENV['FSC_RERUN_FILE_ONLY'])
|
35
35
|
@rspec_usage_patterns = env_var_string_to_pairs(ENV['FSC_USAGE_PATTERNS'])
|
36
36
|
@excluded_tags = env_var_string_to_tags(ENV['FSC_EXCLUDED_TAGS'])
|
37
|
+
@output_file = ENV['FSC_OUTPUT_FILE']
|
37
38
|
end
|
38
39
|
# rubocop:enable Metrics/AbcSize
|
39
40
|
|
@@ -54,6 +55,17 @@ module FlakeySpecCatcher
|
|
54
55
|
else
|
55
56
|
@cli_override.excluded_tags
|
56
57
|
end
|
58
|
+
@output_file = set_output_file
|
59
|
+
end
|
60
|
+
|
61
|
+
def set_output_file
|
62
|
+
if !@cli_override.output_file.nil?
|
63
|
+
@cli_override.output_file
|
64
|
+
elsif @output_file.nil? || @output_file.strip.empty?
|
65
|
+
'/dev/null'
|
66
|
+
else
|
67
|
+
@output_file
|
68
|
+
end
|
57
69
|
end
|
58
70
|
|
59
71
|
def remove_formatter_quotes(env_var)
|
@@ -153,6 +165,8 @@ module FlakeySpecCatcher
|
|
153
165
|
@rspec_usage_patterns = env_var_string_to_pairs(env_value)
|
154
166
|
when 'FSC_EXCLUDED_TAGS'
|
155
167
|
@excluded_tags = env_var_string_to_tags(env_value)
|
168
|
+
when 'FSC_OUTPUT_FILE'
|
169
|
+
@output_file = env_value
|
156
170
|
end
|
157
171
|
end
|
158
172
|
# rubocop:enable Metrics/CyclomaticComplexity
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flakey_spec_catcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Watson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-01-
|
13
|
+
date: 2020-01-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -118,12 +118,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '2.3'
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- - "
|
121
|
+
- - ">"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version:
|
123
|
+
version: 1.3.1
|
124
124
|
requirements: []
|
125
125
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.7.
|
126
|
+
rubygems_version: 2.7.7
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: Run new or changed specs many times to prevent unreliable specs
|