test_suite_splitter 0.0.4 → 0.0.5
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/test_suite_splitter/rspec_helper.rb +13 -19
- 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: 87ca0053702cb8904a2856c58df606e3bd8f12a48cf98e0edc804c7959d9655a
|
|
4
|
+
data.tar.gz: 9a3b00d07bf4ad69343b1ffc3229914b05b7aa4d138f4446331ad056af23c5f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d53b1810eb33ea334e3ce519794112e7c9ec44d9f458e11488058bd5c999a20405d0cba1c55e0d70087ef1f1b871c2632ae6d1c53acf4b8f1435a620fdf23e82
|
|
7
|
+
data.tar.gz: 722e776eadb0266991e96da7f1a64b40b77ca3bfd5c335fe4cdeea5bd2d338260dba602f0127c252d8048e9ad7c232c62abe06db17b4d0d540bf124fe076d4d8
|
|
@@ -76,6 +76,7 @@ class TestSuiteSplitter::RspecHelper
|
|
|
76
76
|
group[:examples] += examples
|
|
77
77
|
group[:files] << file
|
|
78
78
|
group[:seconds] += seconds if seconds
|
|
79
|
+
group[:weight] += file_weight(file, file_data)
|
|
79
80
|
end
|
|
80
81
|
|
|
81
82
|
@group_files = group_orders[@group_number - 1].fetch(:files)
|
|
@@ -88,7 +89,8 @@ class TestSuiteSplitter::RspecHelper
|
|
|
88
89
|
group_orders << {
|
|
89
90
|
examples: 0,
|
|
90
91
|
files: [],
|
|
91
|
-
seconds: 0.0
|
|
92
|
+
seconds: 0.0,
|
|
93
|
+
weight: 0.0
|
|
92
94
|
}
|
|
93
95
|
end
|
|
94
96
|
group_orders
|
|
@@ -96,13 +98,7 @@ class TestSuiteSplitter::RspecHelper
|
|
|
96
98
|
end
|
|
97
99
|
|
|
98
100
|
def group_with_least
|
|
99
|
-
group_orders.
|
|
100
|
-
if example_data_exists? && group1.fetch(:seconds) != 0.0 && group2.fetch(:seconds) != 0.0
|
|
101
|
-
group1.fetch(:seconds) <=> group2.fetch(:seconds)
|
|
102
|
-
else
|
|
103
|
-
group1.fetch(:examples) <=> group2.fetch(:examples)
|
|
104
|
-
end
|
|
105
|
-
end
|
|
101
|
+
group_orders.min_by { |group| group.fetch(:weight) }
|
|
106
102
|
end
|
|
107
103
|
|
|
108
104
|
# Sort them so that they are sorted by file path in three groups so each group have an equal amount of controller specs, features specs and so on
|
|
@@ -114,17 +110,8 @@ class TestSuiteSplitter::RspecHelper
|
|
|
114
110
|
file1_data = example_file(file1_path) if example_data_exists?
|
|
115
111
|
file2_data = example_file(file2_path) if example_data_exists?
|
|
116
112
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
else
|
|
120
|
-
value1 = file1.fetch(:points)
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
if file2_data && file1_data && file2_data.fetch(:seconds) != 0.0 && file2_data.fetch(:seconds) != 0.0
|
|
124
|
-
value2 = file2_data[:seconds]
|
|
125
|
-
else
|
|
126
|
-
value2 = file2.fetch(:points)
|
|
127
|
-
end
|
|
113
|
+
value1 = file_weight(file1, file1_data)
|
|
114
|
+
value2 = file_weight(file2, file2_data)
|
|
128
115
|
|
|
129
116
|
if value1 == value2
|
|
130
117
|
value2 = file1_path
|
|
@@ -137,6 +124,13 @@ class TestSuiteSplitter::RspecHelper
|
|
|
137
124
|
|
|
138
125
|
private
|
|
139
126
|
|
|
127
|
+
def file_weight(file, file_data)
|
|
128
|
+
seconds = file_data&.fetch(:seconds)
|
|
129
|
+
return seconds if seconds&.positive?
|
|
130
|
+
|
|
131
|
+
file.fetch(:points)
|
|
132
|
+
end
|
|
133
|
+
|
|
140
134
|
def dry_result
|
|
141
135
|
@dry_result ||= begin
|
|
142
136
|
require "json"
|