flaky-friend 0.3.1 → 0.3.3
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/lib/flaky/commands/rank.rb +2 -3
- data/lib/flaky/commands/stress.rb +10 -16
- data/lib/flaky/repository.rb +1 -1
- data/lib/flaky/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: 3b8649d4ba762628bf9970b0e493e3d2ab06f7662d136b5f2809816fe243185a
|
|
4
|
+
data.tar.gz: b5db3f2cc290f02fb848ecd08ff72935a5727e8aacad548bad6cf41a83ada669
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: daf4b72ca24fcd98aa0d8a5d9ad8c2d40f465349b3f1bf75c536b820c4297bbaa962dde693c1906db0bc427e58136af7978d611a3319490772cef367081ea1d4
|
|
7
|
+
data.tar.gz: c9594cf996ef4461c496066f94e9eda162400ccf266a371e5331c1bbf216f8261422835933ba7c139a327e7de5a8e17bb78af20eb4e049c12f9155e14507e5a4
|
data/lib/flaky/commands/rank.rb
CHANGED
|
@@ -24,13 +24,12 @@ module Flaky
|
|
|
24
24
|
total_runs = @repo.total_runs_count(branch: branch, since_days: @since_days)
|
|
25
25
|
|
|
26
26
|
puts "Flaky tests on #{branch} (last #{@since_days} days, #{total_runs} CI runs):\n\n"
|
|
27
|
-
puts format("%-6s
|
|
27
|
+
puts format("%-6s %s", "Fails", "Location")
|
|
28
28
|
puts "-" * 90
|
|
29
29
|
|
|
30
30
|
rows.each_with_index do |row, i|
|
|
31
31
|
location = "#{row['spec_file']}:#{row['line_number']}"
|
|
32
|
-
|
|
33
|
-
puts format("%-6d %-50s %s", row["failure_count"], truncated, row["last_failure"])
|
|
32
|
+
puts format("%-6d %s (%s)", row["failure_count"], location, row["last_failure"])
|
|
34
33
|
|
|
35
34
|
if i == 0
|
|
36
35
|
puts "\n \e[33m▶ Next to investigate:\e[0m #{location}"
|
|
@@ -18,14 +18,14 @@ module Flaky
|
|
|
18
18
|
env = {}
|
|
19
19
|
env["FLAKY_CI_SIMULATE"] = "1" if @ci_simulate
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
seed = resolve_seed
|
|
22
22
|
passes = 0
|
|
23
23
|
failures = 0
|
|
24
|
-
failed_seeds =
|
|
24
|
+
failed_seeds = Set.new
|
|
25
25
|
start_time = Time.now
|
|
26
26
|
|
|
27
27
|
puts "Stress testing: #{@spec_location}"
|
|
28
|
-
puts " Iterations: #{@iterations},
|
|
28
|
+
puts " Iterations: #{@iterations}, Seed: #{seed_description(seed)}, CI simulation: #{@ci_simulate}"
|
|
29
29
|
puts ""
|
|
30
30
|
|
|
31
31
|
@iterations.times do |i|
|
|
@@ -35,7 +35,7 @@ module Flaky
|
|
|
35
35
|
break
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
run_seed =
|
|
38
|
+
run_seed = seed.presence || rand(100_000)
|
|
39
39
|
cmd = "bundle exec rspec #{@spec_location} --seed #{run_seed} --format progress 2>&1"
|
|
40
40
|
|
|
41
41
|
output = nil
|
|
@@ -51,7 +51,7 @@ module Flaky
|
|
|
51
51
|
print "\e[32m.\e[0m"
|
|
52
52
|
else
|
|
53
53
|
failures += 1
|
|
54
|
-
failed_seeds
|
|
54
|
+
failed_seeds.add(run_seed)
|
|
55
55
|
print "\e[31mF\e[0m"
|
|
56
56
|
end
|
|
57
57
|
end
|
|
@@ -81,30 +81,24 @@ module Flaky
|
|
|
81
81
|
|
|
82
82
|
private
|
|
83
83
|
|
|
84
|
-
def
|
|
84
|
+
def resolve_seed
|
|
85
85
|
case @seed
|
|
86
86
|
when :random
|
|
87
87
|
nil
|
|
88
88
|
when Integer
|
|
89
|
-
|
|
89
|
+
@seed
|
|
90
90
|
when nil
|
|
91
91
|
file, line = parse_location(@spec_location)
|
|
92
92
|
db_seeds = @repo.failing_seeds(file: file, line: line)
|
|
93
|
-
|
|
94
|
-
puts "Found #{db_seeds.length} known failing seed(s): #{db_seeds.join(', ')}"
|
|
95
|
-
db_seeds
|
|
96
|
-
else
|
|
97
|
-
puts "No known failing seeds — using random."
|
|
98
|
-
nil
|
|
99
|
-
end
|
|
93
|
+
db_seeds.any? ? db_seeds.first : nil
|
|
100
94
|
end
|
|
101
95
|
end
|
|
102
96
|
|
|
103
|
-
def seed_description(
|
|
97
|
+
def seed_description(seed)
|
|
104
98
|
case @seed
|
|
105
99
|
when :random then "random"
|
|
106
100
|
when Integer then @seed.to_s
|
|
107
|
-
else
|
|
101
|
+
else seed.present? ? seed.to_s : "random (no known failing seeds)"
|
|
108
102
|
end
|
|
109
103
|
end
|
|
110
104
|
|
data/lib/flaky/repository.rb
CHANGED
|
@@ -159,7 +159,7 @@ module Flaky
|
|
|
159
159
|
end
|
|
160
160
|
|
|
161
161
|
connection.execute(
|
|
162
|
-
"SELECT
|
|
162
|
+
"SELECT seed, COUNT(*) AS n FROM test_failures WHERE #{conditions.join(' AND ')} GROUP BY seed ORDER BY n DESC, MAX(failed_at) DESC",
|
|
163
163
|
params
|
|
164
164
|
).map { |row| row["seed"] }
|
|
165
165
|
end
|
data/lib/flaky/version.rb
CHANGED