confiner 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30ae8847a7ab0729d5e877f42348713b93f0354c6ea0961f9e5b8cd44a8c18e6
4
- data.tar.gz: e8f469de2c467669cc6ebe5cd2c25a8707749b0901f2165049249962bcbb0868
3
+ metadata.gz: 2aec5b597e2386e03ac5df865c2a0adc622a13ec580047e9a320a5ddf80d486b
4
+ data.tar.gz: 41d27a7ae0f3e5fb86a8d19d00593a043bd08eefb9d9304d531f4ab46e81c726
5
5
  SHA512:
6
- metadata.gz: 8f430addea12b346909efd5568a85d9232fd6f4969258d0aaa5cb9e8344fab58791378734e2c89d58069044739218bd45155ef293487b9a93b95ae5185ed55c7
7
- data.tar.gz: 190392762988fa1273a0e32aa6f74aa9f467879a93729e7a139204e09fb5206cab90e3fecca13a51734bd8917bb2b153e907fc869a3274534f79f163c1dd8d7b
6
+ metadata.gz: a265ca1e725d8075bdd17dfb67ffb2e74fccc171581255b71789f6491e9da2cdb7ee0737073d7dbe3cf02dc9e0cbc85ae9f05538e7021ef5d8eb2ffef53e4961
7
+ data.tar.gz: 35ba5a29c7bed14503fb81db7d791b392167630fe7f8780eb8e93277e0a4dde156d8d358abc68dfe2910eb7ee12fb4338f91d7b627ea5c86f639a2d98c56131d
@@ -24,6 +24,8 @@ module Confiner
24
24
 
25
25
  ENV['GITLAB_API_HTTPARTY_OPTIONS'] = ENV.fetch('GITLAB_API_HTTPARTY_OPTIONS') { "{read_timeout: #{timeout}}" }
26
26
 
27
+ raise ArgumentError, 'Missing private_token' if private_token.nil?
28
+
27
29
  @gitlab_client = ::Gitlab.client(private_token: private_token, endpoint: endpoint)
28
30
  end
29
31
 
@@ -184,7 +186,7 @@ module Confiner
184
186
  # @param [Gitlab::ObjectifiedHash] failure_issue the existing failure issue
185
187
  # @return [Gitlab::ObjectifiedHash] the new branch
186
188
  def create_branch(failure_issue, example)
187
- branch = @gitlab_client.create_branch(target_project, "#{failure_issue['iid']}-quarantine-#{example.name.tr(' ', '-')}", ref)
189
+ branch = @gitlab_client.create_branch(target_project, "#{failure_issue['iid']}-quarantine-#{example.name.gsub(/\W/, '-')}", ref)
188
190
 
189
191
  log :branch, "Created branch #{branch['name']} (#{branch['web_url']})", 4
190
192
 
@@ -228,13 +230,15 @@ module Confiner
228
230
  end
229
231
  end
230
232
 
233
+ meets_or_exceeds_threshold = occurrences.size > threshold ? 'exceeds' : 'meets'
234
+
231
235
  description = <<~MARKDOWN
232
236
  ## What does this MR do?
233
237
 
234
238
  Quarantines the test `#{example.name}` (https://gitlab.com/#{target_project}/-/blob/#{ref}/#{example.file}#L#{changed_line_number})
235
239
 
236
- This test has been found by [Confiner](https://gitlab.com/gitlab-org/quality/confiner) to have been failing for
237
- more than (or equal to) #{threshold} times. This test has failed #{occurrences.size} times.
240
+ This test has been found by [Confiner](https://gitlab.com/gitlab-org/quality/confiner) to have failed
241
+ #{occurrences.size} times, which #{meets_or_exceeds_threshold} the threshold of #{threshold} times.
238
242
 
239
243
  #{markdown_occurrences.join("\n")}
240
244
 
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Confiner
4
+ VERSION = '0.2.2'
5
+ end
data/lib/confiner.rb CHANGED
@@ -7,7 +7,5 @@ loader.push_dir(__dir__)
7
7
  loader.setup
8
8
 
9
9
  module Confiner
10
- VERSION = '0.2.1'
11
-
12
10
  module Plugins; end
13
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confiner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-07 00:00:00.000000000 Z
11
+ date: 2022-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.10.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-parameterized
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.5.1
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.5.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: zeitwerk
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -68,6 +82,7 @@ files:
68
82
  - lib/confiner/plugin.rb
69
83
  - lib/confiner/plugins/debug.rb
70
84
  - lib/confiner/plugins/gitlab.rb
85
+ - lib/confiner/version.rb
71
86
  homepage: https://gitlab.com/gitlab-org/quality/confiner
72
87
  licenses:
73
88
  - MIT