flakey_spec_catcher 0.9.8 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/flakey_spec_catcher.gemspec +6 -4
- data/lib/flakey_spec_catcher/cli_override.rb +5 -1
- data/lib/flakey_spec_catcher/git_controller.rb +7 -40
- data/lib/flakey_spec_catcher/runner.rb +2 -0
- data/lib/flakey_spec_catcher/user_config.rb +2 -0
- data/lib/flakey_spec_catcher/version.rb +1 -1
- metadata +38 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9894969be42fdb7dfafa961942ce16b1313ca3cffdc746d9613ebe1398d39069
|
4
|
+
data.tar.gz: 75238a79f25ddb8cec6fd60064e9f06d5f5651b8bb3c27e423f317f653f65774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3698a10fd2c5d4ae75f3fe0250d7578a82906eb6ad478c759756911501b8f53125a63f1ced325e51c6115a9f76c7ac2264ae28a42c8b65273376186e8e7aa34
|
7
|
+
data.tar.gz: 440e5ef180775556f3292548330cf9572db13d82394921fbbca6053b37ed4c088aa5c37b9dcb06ab2fb4049879c7fe2a093a60cf05da649abb950bf01d0af6cf
|
data/.gitignore
CHANGED
data/flakey_spec_catcher.gemspec
CHANGED
@@ -28,11 +28,13 @@ Gem::Specification.new do |gem|
|
|
28
28
|
gem.require_paths = ['lib']
|
29
29
|
|
30
30
|
gem.metadata['allowed_push_host'] = 'https://rubygems.org'
|
31
|
-
gem.required_ruby_version = '>= 2.
|
31
|
+
gem.required_ruby_version = '>= 2.6'
|
32
32
|
|
33
|
-
gem.add_dependency 'rspec', '~> 3.
|
33
|
+
gem.add_dependency 'rspec', '~> 3.10'
|
34
|
+
gem.add_development_dependency 'byebug', '~> 11.1'
|
34
35
|
gem.add_development_dependency 'climate_control', '~> 0.2'
|
35
|
-
gem.add_development_dependency 'rake', '~>
|
36
|
-
gem.add_development_dependency '
|
36
|
+
gem.add_development_dependency 'rake', '~> 13.0'
|
37
|
+
gem.add_development_dependency 'rubocop', '~> 0.93.1'
|
38
|
+
gem.add_development_dependency 'simplecov', '~> 0.19'
|
37
39
|
end
|
38
40
|
# rubocop:enable Layout/ExtraSpacing, Layout/SpaceAroundOperators
|
@@ -8,7 +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, :use_parent, :dry_run
|
11
|
-
attr_reader :output_file, :split_nodes, :split_index, :verbose, :test_options
|
11
|
+
attr_reader :output_file, :split_nodes, :split_index, :verbose, :test_options, :break_on_first_failure
|
12
12
|
|
13
13
|
def initialize
|
14
14
|
@dry_run = false
|
@@ -56,6 +56,10 @@ module FlakeySpecCatcher
|
|
56
56
|
@repeat_factor = remove_formatter_quotes(repeat).to_i
|
57
57
|
end
|
58
58
|
|
59
|
+
opts.on('--break-on-first-failure', 'Break on first failure') do |break_on_first_failure|
|
60
|
+
@break_on_first_failure = break_on_first_failure
|
61
|
+
end
|
62
|
+
|
59
63
|
opts.on('-e', '--excluded-tags=EXCLUDED_TAGS',
|
60
64
|
'Specify tags to exclude in a comma separated list') do |tags|
|
61
65
|
@excluded_tags = parse_tags(tags)
|
@@ -56,45 +56,12 @@ module FlakeySpecCatcher
|
|
56
56
|
return nil if @remote.nil?
|
57
57
|
|
58
58
|
working_branch = `git branch | grep '*'`.delete('*').gsub(/\s+/, '')
|
59
|
-
|
60
|
-
|
61
|
-
# Assume master if no matches
|
62
|
-
|
63
|
-
# Example output
|
64
|
-
# * remote origin
|
65
|
-
# Fetch URL: gerrit:repo
|
66
|
-
# Push URL: gerrit:repo
|
67
|
-
# HEAD branch: master
|
68
|
-
# Remote branches:
|
69
|
-
# dev/reports tracked
|
70
|
-
# edge tracked
|
71
|
-
# master tracked
|
72
|
-
# Local branch configured for 'git pull':
|
73
|
-
# master merges with remote master
|
74
|
-
# Local refs configured for 'git push':
|
75
|
-
# dev/reports pushes to dev/reports (up to date)
|
76
|
-
# master pushes to master (up to date)
|
77
|
-
|
78
|
-
remote_branches = `git remote show #{@remote}`.split("\n")
|
79
|
-
|
80
|
-
# Separate 'dev/reports pushes to dev/reports (up to date)' into
|
81
|
-
# ['dev/reports', 'dev/reports'] or [<LOCAL BRANCH>, <REMOTE BRANCH>]
|
82
|
-
remote_pairs = remote_branches.map { |r| r.scan(/(\S*)\s+pushes to\s+(\S*)\s+/).flatten }
|
83
|
-
|
84
|
-
# check if the working branch (currently checked out branch) corresponds to a remote_pair
|
85
|
-
# if so, use that remote pair for comparison, else use master
|
86
|
-
match = remote_pairs.find do |pair|
|
87
|
-
# working branch (pair[0]) pushes to remote (pair[1])
|
88
|
-
pair[0] == working_branch
|
89
|
-
end
|
59
|
+
branch_remote = `git config branch.#{working_branch}.remote`.strip
|
60
|
+
return 'master' unless @remote == branch_remote
|
90
61
|
|
91
|
-
remote_branch =
|
92
|
-
|
93
|
-
|
94
|
-
# match is formatted as [working_branch, remote]
|
95
|
-
match[1]
|
96
|
-
end
|
97
|
-
remote_branch
|
62
|
+
remote_branch = `git config branch.#{branch}.merge`.strip.sub(%r{^refs/heads/}, '')
|
63
|
+
remote_branch = nil if remote_branch.empty?
|
64
|
+
remote_branch || 'master'
|
98
65
|
end
|
99
66
|
|
100
67
|
def initialize_git_comparison(test_mode)
|
@@ -108,7 +75,7 @@ module FlakeySpecCatcher
|
|
108
75
|
@git_comparison = "#{@base_commit_sha}..#{@working_commit_sha}"
|
109
76
|
end
|
110
77
|
|
111
|
-
# rubocop:disable Metrics/
|
78
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
112
79
|
def parse_changes
|
113
80
|
# For each file, get the change block
|
114
81
|
diff_files.each do |filename|
|
@@ -128,7 +95,7 @@ module FlakeySpecCatcher
|
|
128
95
|
end
|
129
96
|
end
|
130
97
|
end
|
131
|
-
# rubocop:enable Metrics/
|
98
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
132
99
|
|
133
100
|
def identify_change_contexts
|
134
101
|
@capsule_manager.change_capsules.each(&:fill_contexts)
|
@@ -36,6 +36,7 @@ module FlakeySpecCatcher
|
|
36
36
|
puts " Current Sha: #{@git_controller.working_commit_sha}"
|
37
37
|
puts " Base Sha: #{@git_controller.base_commit_sha}"
|
38
38
|
puts " Repeat factor: #{@user_config.repeat_factor}"
|
39
|
+
puts " Break on first failure: #{@user_config.break_on_first_failure}" if @user_config.break_on_first_failure
|
39
40
|
puts " Node Total: #{@user_config.split_nodes}" if @user_config.split_nodes
|
40
41
|
puts " Node Index: #{@user_config.split_index}" if @user_config.split_index
|
41
42
|
puts " Changed Specs Detected: #{@git_controller.changed_examples}"
|
@@ -75,6 +76,7 @@ module FlakeySpecCatcher
|
|
75
76
|
@user_config.repeat_factor.times do
|
76
77
|
iteration_status = handle_capsule_rerun(capsule)
|
77
78
|
status = [status, iteration_status].max
|
79
|
+
break if @user_config.break_on_first_failure && !status.zero?
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
@@ -12,6 +12,7 @@ module FlakeySpecCatcher
|
|
12
12
|
attr_reader :manual_rerun_patterns, :manual_rerun_usage
|
13
13
|
attr_reader :enable_runs, :output_file, :use_parent, :dry_run
|
14
14
|
attr_reader :split_nodes, :split_index, :verbose, :test_options
|
15
|
+
attr_reader :break_on_first_failure
|
15
16
|
|
16
17
|
USER_CONFIG_ENV_VARS = %w[FSC_REPEAT_FACTOR FSC_IGNORE_FILES FSC_IGNORE_BRANCHES
|
17
18
|
FSC_SILENT_MODE FSC_RERUN_FILE_ONLY FSC_USAGE_PATTERNS
|
@@ -44,6 +45,7 @@ module FlakeySpecCatcher
|
|
44
45
|
@manual_rerun_usage = @cli_override.rerun_usage
|
45
46
|
@use_parent = @cli_override.use_parent
|
46
47
|
@repeat_factor = @cli_override.repeat_factor if @cli_override.repeat_factor.to_i.positive?
|
48
|
+
@break_on_first_failure = @cli_override.break_on_first_failure
|
47
49
|
@enable_runs = @cli_override.enable_runs
|
48
50
|
@dry_run = @cli_override.dry_run
|
49
51
|
@split_nodes = @cli_override.split_nodes unless @cli_override.split_nodes.nil?
|
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.10.0
|
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:
|
13
|
+
date: 2021-07-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -18,14 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '3.
|
21
|
+
version: '3.10'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '3.
|
28
|
+
version: '3.10'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: byebug
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '11.1'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '11.1'
|
29
43
|
- !ruby/object:Gem::Dependency
|
30
44
|
name: climate_control
|
31
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,28 +60,42 @@ dependencies:
|
|
46
60
|
requirements:
|
47
61
|
- - "~>"
|
48
62
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
63
|
+
version: '13.0'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '13.0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: rubocop
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.93.1
|
50
78
|
type: :development
|
51
79
|
prerelease: false
|
52
80
|
version_requirements: !ruby/object:Gem::Requirement
|
53
81
|
requirements:
|
54
82
|
- - "~>"
|
55
83
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
84
|
+
version: 0.93.1
|
57
85
|
- !ruby/object:Gem::Dependency
|
58
86
|
name: simplecov
|
59
87
|
requirement: !ruby/object:Gem::Requirement
|
60
88
|
requirements:
|
61
89
|
- - "~>"
|
62
90
|
- !ruby/object:Gem::Version
|
63
|
-
version: '0.
|
91
|
+
version: '0.19'
|
64
92
|
type: :development
|
65
93
|
prerelease: false
|
66
94
|
version_requirements: !ruby/object:Gem::Requirement
|
67
95
|
requirements:
|
68
96
|
- - "~>"
|
69
97
|
- !ruby/object:Gem::Version
|
70
|
-
version: '0.
|
98
|
+
version: '0.19'
|
71
99
|
description:
|
72
100
|
email:
|
73
101
|
- bwatson@instructure.com
|
@@ -115,14 +143,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
143
|
requirements:
|
116
144
|
- - ">="
|
117
145
|
- !ruby/object:Gem::Version
|
118
|
-
version: '2.
|
146
|
+
version: '2.6'
|
119
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
148
|
requirements:
|
121
149
|
- - ">="
|
122
150
|
- !ruby/object:Gem::Version
|
123
151
|
version: '0'
|
124
152
|
requirements: []
|
125
|
-
rubygems_version: 3.0.
|
153
|
+
rubygems_version: 3.0.1
|
126
154
|
signing_key:
|
127
155
|
specification_version: 4
|
128
156
|
summary: Run new or changed specs many times to prevent unreliable specs
|