gitlab_quality-test_tooling 0.9.0 → 0.9.1
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/Gemfile.lock +1 -1
- data/lib/gitlab_quality/test_tooling/report/report_as_issue.rb +24 -1
- data/lib/gitlab_quality/test_tooling/report/slow_test_issue.rb +6 -27
- data/lib/gitlab_quality/test_tooling/test_result/json_test_result.rb +4 -0
- data/lib/gitlab_quality/test_tooling/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 145ee9c8df7307958d5fa46edbff45de7ed0bb604dc213fb9ac5813cd1057327
|
4
|
+
data.tar.gz: 4308fca7357956cf7a236cd59337eb9677de2582f459c2a617da06ba157c60cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5a96691899147d6e61e6d98c24e63b8efe2e5d6cbf4870ea9c1095dfdc7d5091e9381def5a77a5b43dfa85e8c49b6b64bce34852f00b5a4dd61fbda6da70d10
|
7
|
+
data.tar.gz: daa62f692125939eb89b2ffe0664527bcc7078574327a874fe180889358d421686de8cbaeb22ddb83ef71247cea967f3b5d2dd3888415eb764569b2f701034e0
|
data/Gemfile.lock
CHANGED
@@ -10,6 +10,17 @@ module GitlabQuality
|
|
10
10
|
|
11
11
|
FILE_BASE_URL = "https://gitlab.com/gitlab-org/gitlab/-/blob/master/"
|
12
12
|
|
13
|
+
OTHER_TESTS_MAX_DURATION = 45.40 # seconds
|
14
|
+
|
15
|
+
TestLevelSpecification = Struct.new(:regex, :max_duration)
|
16
|
+
|
17
|
+
TEST_LEVEL_SPECIFICATIONS = [
|
18
|
+
TestLevelSpecification.new(%r{spec/features/}, 50.13),
|
19
|
+
TestLevelSpecification.new(%r{spec/(controllers|requests)/}, 19.20),
|
20
|
+
TestLevelSpecification.new(%r{spec/lib/}, 27.12),
|
21
|
+
TestLevelSpecification.new(%r{qa/specs/features/}, 240)
|
22
|
+
].freeze
|
23
|
+
|
13
24
|
def initialize(token:, input_files:, project: nil, dry_run: false, **_kwargs)
|
14
25
|
@project = project
|
15
26
|
@gitlab = (dry_run ? GitlabIssueDryClient : GitlabIssueClient).new(token: token, project: project)
|
@@ -42,7 +53,10 @@ module GitlabQuality
|
|
42
53
|
| ------ | ------ |
|
43
54
|
| File | #{test_file_link(test)} |
|
44
55
|
| Description | `#{test.name}` |
|
56
|
+
| Test level | #{test.level} |
|
45
57
|
| Hash | `#{test_hash(test)}` |
|
58
|
+
| Duration | #{test.run_time} seconds |
|
59
|
+
| Expected duration | < #{max_duration_for_test(test)} seconds |
|
46
60
|
#{"| Test case | #{test.testcase} |" if test.testcase}
|
47
61
|
DESCRIPTION
|
48
62
|
end
|
@@ -50,7 +64,7 @@ module GitlabQuality
|
|
50
64
|
def test_file_link(test)
|
51
65
|
path_prefix = test.file.start_with?('qa/') ? 'qa/' : ''
|
52
66
|
|
53
|
-
"[`#{path_prefix}#{test.file}`](#{FILE_BASE_URL}#{path_prefix}#{test.file}#L#{test.line_number})"
|
67
|
+
"[`#{path_prefix}#{test.file}#L#{test.line_number}`](#{FILE_BASE_URL}#{path_prefix}#{test.file}#L#{test.line_number})"
|
54
68
|
end
|
55
69
|
|
56
70
|
def new_issue_labels(_test)
|
@@ -155,6 +169,15 @@ module GitlabQuality
|
|
155
169
|
def ee_test?(test)
|
156
170
|
test.file =~ %r{features/ee/(api|browser_ui)}
|
157
171
|
end
|
172
|
+
|
173
|
+
def max_duration_for_test(test)
|
174
|
+
test_level_specification = TEST_LEVEL_SPECIFICATIONS.find do |test_level_specification|
|
175
|
+
test.example_id =~ test_level_specification.regex
|
176
|
+
end
|
177
|
+
return OTHER_TESTS_MAX_DURATION unless test_level_specification
|
178
|
+
|
179
|
+
test_level_specification.max_duration
|
180
|
+
end
|
158
181
|
end
|
159
182
|
end
|
160
183
|
end
|
@@ -13,21 +13,11 @@ module GitlabQuality
|
|
13
13
|
include Concerns::FindSetDri
|
14
14
|
include Concerns::GroupAndCategoryLabels
|
15
15
|
|
16
|
-
NEW_ISSUE_LABELS = Set.new(
|
16
|
+
NEW_ISSUE_LABELS = Set.new(['test', 'type::maintenance', 'maintenance::performance', 'priority::3', 'severity::3', 'rspec profiling', 'rspec:slow test']).freeze
|
17
17
|
SEARCH_LABELS = %w[test maintenance::performance].freeze
|
18
18
|
|
19
19
|
MultipleIssuesFound = Class.new(StandardError)
|
20
20
|
|
21
|
-
TestLevelSpecification = Struct.new(:regex, :max_duration)
|
22
|
-
|
23
|
-
OTHER_TESTS_MAX_DURATION = 45.40 # seconds
|
24
|
-
|
25
|
-
TEST_LEVEL_SPECIFICATIONS = [
|
26
|
-
TestLevelSpecification.new(%r{/features/}, 50.13),
|
27
|
-
TestLevelSpecification.new(%r{/controllers|requests/}, 19.20),
|
28
|
-
TestLevelSpecification.new(%r{/lib/}, 27.12)
|
29
|
-
].freeze
|
30
|
-
|
31
21
|
private
|
32
22
|
|
33
23
|
def run!
|
@@ -47,13 +37,11 @@ module GitlabQuality
|
|
47
37
|
end
|
48
38
|
|
49
39
|
def new_issue_description(test)
|
50
|
-
super +
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
"**Duration**: #{test.run_time} seconds"
|
56
|
-
].compact.join("\n\n")
|
40
|
+
super +
|
41
|
+
<<~DESCRIPTION
|
42
|
+
Slow tests were detected, please see the [test speed best practices guide](https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#test-speed)
|
43
|
+
to improve them. More context available about this issue in the [top slow tests guide](https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#top-slow-tests).
|
44
|
+
DESCRIPTION
|
57
45
|
end
|
58
46
|
|
59
47
|
def create_slow_issue(test)
|
@@ -73,15 +61,6 @@ module GitlabQuality
|
|
73
61
|
def should_create_slow_issue?(test)
|
74
62
|
test.run_time > max_duration_for_test(test)
|
75
63
|
end
|
76
|
-
|
77
|
-
def max_duration_for_test(test)
|
78
|
-
test_level_specification = TEST_LEVEL_SPECIFICATIONS.find do |test_level_specification|
|
79
|
-
test.example_id =~ test_level_specification.regex
|
80
|
-
end
|
81
|
-
return OTHER_TESTS_MAX_DURATION unless test_level_specification
|
82
|
-
|
83
|
-
test_level_specification.max_duration
|
84
|
-
end
|
85
64
|
end
|
86
65
|
end
|
87
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_quality-test_tooling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab Quality
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|