gitlab-exporter 13.5.0 → 14.1.0

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: 71244a8992a3116e4513746514842e6d6f0c53abbef7e0a7435a3889acce66c1
4
- data.tar.gz: fc013ec18e7f7a11e3d5da3a1375fe80add92f96da1f572eb8b577ee98bedebb
3
+ metadata.gz: dd25ebf8533fde9c59b0db768540fcbdf338c961715617459c2a4aa2eb2cc912
4
+ data.tar.gz: 12e190d1ea1f1cf0a16aa68ab54995c4953555807c7e3c80ecf8a40072d811dd
5
5
  SHA512:
6
- metadata.gz: b4d3c84092ca842c13123bb6573118adc44b60f090594db51b559bc20d2718c1e8a341494fd6ba376e6a30ce07985b2ae88923e7a68760a631936f3e962ed62f
7
- data.tar.gz: eb579c03705bdbd4d64b5c0a5b6dc40cbfa0125939b03d250d6efe44f395fe55effabbf3733ab57a0297494530ce8efc5b3521eda12c930b7ec8ffeadc8fb7b0
6
+ metadata.gz: f482931b5c30361f7d9e2899c47de30e4fe296b02028818c83bf189defcd8e0dd6fa30f411c1a96e2abab809c1d45ea4c679479b61ac093c09d678154a8b6ce5
7
+ data.tar.gz: 5942a5b4b0ea8ecdccdab0de8a5bfdad2f7b1f125e200bfc94e64cf4328ca750cf866ccd394dbe14dfc91fe3dcc5915332e5519c9f9d37682f49251ac2a7b581
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-exporter (13.5.0)
4
+ gitlab-exporter (14.1.0)
5
5
  connection_pool (= 2.2.5)
6
+ deep_merge (~> 1.2.2)
6
7
  faraday (~> 1.8.0)
7
8
  pg (= 1.5.3)
8
9
  puma (= 5.6.5)
@@ -18,6 +19,7 @@ GEM
18
19
  specs:
19
20
  ast (2.4.1)
20
21
  connection_pool (2.2.5)
22
+ deep_merge (1.2.2)
21
23
  diff-lcs (1.5.0)
22
24
  faraday (1.8.0)
23
25
  faraday-em_http (~> 1.0)
@@ -107,4 +109,4 @@ DEPENDENCIES
107
109
  rubocop (~> 0.42)
108
110
 
109
111
  BUNDLED WITH
110
- 2.4.5
112
+ 2.4.20
data/README.md CHANGED
@@ -95,6 +95,25 @@ Once running, you can point your browser or curl to the following URLs:
95
95
  * http://localhost:9168/sidekiq
96
96
  * http://localhost:9168/metrics (to get all of the above combined)
97
97
 
98
+ If it is undesirable to have secrets (e.g. Redis password or PostgreSQL credentials) in the config file,
99
+ then you can specify an external command (with the `--extra-config-command <command>` flag) that outputs
100
+ such credentials in a YAML form (same structure as the config file) and it will be merged with the file configuration.
101
+
102
+ For example:
103
+
104
+ ```
105
+ $ vault kv get -format=yaml secrets/gitlab/gitlab-exporter
106
+ probes:
107
+ sidekiq:
108
+ opts:
109
+ redis_url: redis://hunter1@localhost:9765
110
+ database:
111
+ opts:
112
+ connection_string: postgres://db-admin:hunter1@localhost:6543/main-db
113
+
114
+ $ bin/gitlab-exporter web -c config/gitlab-exporter.yml --extra-config-command "vault kv get -format=yaml secrets/gitlab/gitlab-exporter"
115
+ ```
116
+
98
117
  ### Database Bloat Metrics
99
118
 
100
119
  Database bloat is measured for indexes (`btree`) and/or tables
@@ -95,8 +95,6 @@ probes:
95
95
  opts:
96
96
  redis_url: "redis://localhost:6379"
97
97
  redis_enable_client: true
98
- probe_namespaced: true
99
- probe_non_namespaced: true
100
98
 
101
99
  ruby: &ruby
102
100
  class_name: RubyProber
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.license = "MIT"
22
22
 
23
23
  s.add_runtime_dependency "connection_pool", "2.2.5"
24
+ s.add_runtime_dependency "deep_merge", "~> 1.2.2"
24
25
  s.add_runtime_dependency "faraday", "~> 1.8.0"
25
26
  s.add_runtime_dependency "pg", "1.5.3"
26
27
  s.add_runtime_dependency "puma", "5.6.5"
@@ -1,4 +1,6 @@
1
1
  require "yaml"
2
+ require "deep_merge"
3
+ require "English"
2
4
 
3
5
  # TODO: Remove this once we're on Ruby 3
4
6
  # https://gitlab.com/gitlab-org/gitlab/-/issues/393651
@@ -188,6 +190,10 @@ module GitLab
188
190
  opts.on("-c config.yml", "Monitoring config") do |val|
189
191
  @config_file = val
190
192
  end
193
+ opts.on("--extra-config-command command", "Shell command that returns YAML config to be merged
194
+ with the config file") do |val|
195
+ @extra_config_command = val
196
+ end
191
197
  end
192
198
  end
193
199
 
@@ -195,12 +201,17 @@ module GitLab
195
201
  @options.help
196
202
  end
197
203
 
204
+ def merged_config
205
+ config_from_file = Utils.deep_symbolize_hash_keys(YAML.safe_load_file(@config_file, aliases: true))
206
+ config_from_command = extra_config_from_command
207
+
208
+ config_from_file.deep_merge!(config_from_command)
209
+ end
210
+
198
211
  def run
199
212
  validate!
200
213
 
201
- config = Utils.deep_symbolize_hash_keys(YAML.safe_load_file(@config_file, aliases: true))
202
-
203
- WebExporter.setup(config)
214
+ WebExporter.setup(merged_config)
204
215
  WebExporter.run!
205
216
  end
206
217
 
@@ -209,6 +220,22 @@ module GitLab
209
220
  def validate!
210
221
  fail InvalidCLICommand.new(help) unless @config_file
211
222
  end
223
+
224
+ def run_extra_config_command
225
+ puts "Using extra config by running command `#{@extra_config_command}`"
226
+
227
+ output = `#{@extra_config_command}`
228
+ return output if $CHILD_STATUS == 0
229
+
230
+ puts "ERROR: command `#{@extra_config_command}` returned a non-zero code."
231
+ exit(2)
232
+ end
233
+
234
+ def extra_config_from_command
235
+ return {} unless @extra_config_command
236
+
237
+ Utils.deep_symbolize_hash_keys(YAML.safe_load(run_extra_config_command))
238
+ end
212
239
  end
213
240
 
214
241
  # Process runner
@@ -7,7 +7,6 @@ module GitLab
7
7
  # A prober for Sidekiq queues
8
8
  #
9
9
  # It takes the Redis URL Sidekiq is connected to
10
- # rubocop:disable Metrics/ClassLength
11
10
  class SidekiqProber
12
11
  # The maximum depth (from the head) of each queue to probe. Probing the
13
12
  # entirety of a very large queue will take longer and run the risk of
@@ -41,24 +40,35 @@ module GitLab
41
40
  @opts = opts
42
41
  @metrics = metrics
43
42
  @logger = logger
44
-
45
- @probe_namespaced = !!opts[:probe_namespaced] # rubocop:disable Style/DoubleNegation
46
- @probe_non_namespaced = !!opts[:probe_non_namespaced] # rubocop:disable Style/DoubleNegation
47
-
48
- # to maintain backward compatibility if the config is missing values
49
- @probe_namespaced = true if opts[:probe_namespaced].nil? && opts[:probe_non_namespaced].nil?
50
43
  end
51
44
 
52
45
  def probe_stats
53
- with_sidekiq { _probe_stats } if @probe_namespaced
54
- with_sidekiq(false) { _probe_stats(false) } if @probe_non_namespaced
46
+ with_sidekiq do
47
+ stats = Sidekiq::Stats.new
48
+
49
+ @metrics.add("sidekiq_jobs_processed_total", stats.processed)
50
+ @metrics.add("sidekiq_jobs_failed_total", stats.failed)
51
+ @metrics.add("sidekiq_jobs_enqueued_size", stats.enqueued)
52
+ @metrics.add("sidekiq_jobs_scheduled_size", stats.scheduled_size)
53
+ @metrics.add("sidekiq_jobs_retry_size", stats.retry_size)
54
+ @metrics.add("sidekiq_jobs_dead_size", stats.dead_size)
55
+
56
+ @metrics.add("sidekiq_default_queue_latency_seconds", stats.default_queue_latency)
57
+ @metrics.add("sidekiq_processes_size", stats.processes_size)
58
+ @metrics.add("sidekiq_workers_size", stats.workers_size)
59
+ end
55
60
 
56
61
  self
57
62
  end
58
63
 
59
64
  def probe_queues
60
- with_sidekiq { _probe_queues } if @probe_namespaced
61
- with_sidekiq(false) { _probe_queues(false) } if @probe_non_namespaced
65
+ with_sidekiq do
66
+ Sidekiq::Queue.all.each do |queue|
67
+ @metrics.add("sidekiq_queue_size", queue.size, name: queue.name)
68
+ @metrics.add("sidekiq_queue_latency_seconds", queue.latency, name: queue.name)
69
+ @metrics.add("sidekiq_queue_paused", queue.paused? ? 1 : 0, name: queue.name)
70
+ end
71
+ end
62
72
 
63
73
  self
64
74
  end
@@ -71,8 +81,24 @@ module GitLab
71
81
  end
72
82
 
73
83
  def probe_future_sets
74
- with_sidekiq { _probe_future_sets } if @probe_namespaced
75
- with_sidekiq(false) { _probe_future_sets(false) } if @probe_non_namespaced
84
+ now = Time.now.to_f
85
+ with_sidekiq do
86
+ Sidekiq.redis do |conn|
87
+ Sidekiq::Scheduled::SETS.each do |set|
88
+ # Default to 0; if all jobs are due in the future, there is no "negative" delay.
89
+ delay = 0
90
+
91
+ _job, timestamp = conn.zrangebyscore(set, "-inf", now.to_s, limit: [0, 1], withscores: true).first
92
+ delay = now - timestamp if timestamp
93
+
94
+ @metrics.add("sidekiq_#{set}_set_processing_delay_seconds", delay)
95
+
96
+ # zcount is O(log(N)) (prob. binary search), so is still quick even with large sets
97
+ @metrics.add("sidekiq_#{set}_set_backlog_count",
98
+ conn.zcount(set, "-inf", now.to_s))
99
+ end
100
+ end
101
+ end
76
102
  end
77
103
 
78
104
  # Count worker classes present in Sidekiq queues. This only looks at the
@@ -82,22 +108,57 @@ module GitLab
82
108
  # will not have completely accurate statistics, but the probe performance
83
109
  # will also not degrade as the queue gets larger.
84
110
  def probe_jobs_limit
85
- with_sidekiq { _probe_jobs_limit } if @probe_namespaced
86
- with_sidekiq(false) { _probe_jobs_limit(false) } if @probe_non_namespaced
111
+ with_sidekiq do
112
+ job_stats = Hash.new(0)
113
+
114
+ Sidekiq::Queue.all.each do |queue|
115
+ Sidekiq.redis do |conn|
116
+ conn.lrange("queue:#{queue.name}", 0, PROBE_JOBS_LIMIT).each do |job|
117
+ job_class = Sidekiq.load_json(job)["class"]
118
+
119
+ job_stats[job_class] += 1
120
+ end
121
+ end
122
+ end
123
+
124
+ job_stats.each do |class_name, count|
125
+ @metrics.add("sidekiq_enqueued_jobs", count, name: class_name)
126
+ end
127
+ end
87
128
 
88
129
  self
89
130
  end
90
131
 
91
132
  def probe_workers
92
- with_sidekiq { _probe_workers } if @probe_namespaced
93
- with_sidekiq(false) { _probe_workers(false) } if @probe_non_namespaced
133
+ with_sidekiq do
134
+ worker_stats = Hash.new(0)
135
+
136
+ Sidekiq::Workers.new.map do |_pid, _tid, work|
137
+ job_klass = work["payload"]["class"]
138
+
139
+ worker_stats[job_klass] += 1
140
+ end
141
+
142
+ worker_stats.each do |class_name, count|
143
+ @metrics.add("sidekiq_running_jobs", count, name: class_name)
144
+ end
145
+ end
94
146
 
95
147
  self
96
148
  end
97
149
 
98
150
  def probe_retries
99
- with_sidekiq { _probe_retries } if @probe_namespaced
100
- with_sidekiq(false) { _probe_retries(false) } if @probe_non_namespaced
151
+ with_sidekiq do
152
+ retry_stats = Hash.new(0)
153
+
154
+ Sidekiq::RetrySet.new.map do |job|
155
+ retry_stats[job.klass] += 1
156
+ end
157
+
158
+ retry_stats.each do |class_name, count|
159
+ @metrics.add("sidekiq_to_be_retried_jobs", count, name: class_name)
160
+ end
161
+ end
101
162
 
102
163
  self
103
164
  end
@@ -119,104 +180,10 @@ module GitLab
119
180
 
120
181
  private
121
182
 
122
- def _probe_workers(namespace = true)
123
- labels = add_namespace_labels? ? { namespaced: namespace } : {}
124
- worker_stats = Hash.new(0)
125
-
126
- Sidekiq::Workers.new.map do |_pid, _tid, work|
127
- job_klass = work["payload"]["class"]
128
-
129
- worker_stats[job_klass] += 1
130
- end
131
-
132
- worker_stats.each do |class_name, count|
133
- @metrics.add("sidekiq_running_jobs", count, **labels.merge({ name: class_name }))
134
- end
135
- end
136
-
137
- def _probe_future_sets(namespace = true)
138
- labels = add_namespace_labels? ? { namespaced: namespace } : {}
139
- now = Time.now.to_f
140
- Sidekiq.redis do |conn|
141
- Sidekiq::Scheduled::SETS.each do |set|
142
- # Default to 0; if all jobs are due in the future, there is no "negative" delay.
143
- delay = 0
144
-
145
- _job, timestamp = conn.zrangebyscore(set, "-inf", now.to_s, limit: [0, 1], withscores: true).first
146
- delay = now - timestamp if timestamp
147
-
148
- @metrics.add("sidekiq_#{set}_set_processing_delay_seconds", delay, **labels)
149
-
150
- # zcount is O(log(N)) (prob. binary search), so is still quick even with large sets
151
- @metrics.add("sidekiq_#{set}_set_backlog_count",
152
- conn.zcount(set, "-inf", now.to_s), **labels)
153
- end
154
- end
155
- end
156
-
157
- def _probe_stats(namespace = true)
158
- stats = Sidekiq::Stats.new
159
- labels = add_namespace_labels? ? { namespaced: namespace } : {}
160
-
161
- @metrics.add("sidekiq_jobs_processed_total", stats.processed, **labels)
162
- @metrics.add("sidekiq_jobs_failed_total", stats.failed, **labels)
163
- @metrics.add("sidekiq_jobs_enqueued_size", stats.enqueued, **labels)
164
- @metrics.add("sidekiq_jobs_scheduled_size", stats.scheduled_size, **labels)
165
- @metrics.add("sidekiq_jobs_retry_size", stats.retry_size, **labels)
166
- @metrics.add("sidekiq_jobs_dead_size", stats.dead_size, **labels)
167
-
168
- @metrics.add("sidekiq_default_queue_latency_seconds", stats.default_queue_latency, **labels)
169
- @metrics.add("sidekiq_processes_size", stats.processes_size, **labels)
170
- @metrics.add("sidekiq_workers_size", stats.workers_size, **labels)
171
- end
172
-
173
- def _probe_queues(namespace = true)
174
- Sidekiq::Queue.all.each do |queue|
175
- labels = { name: queue.name }
176
- labels[:namespaced] = namespace if add_namespace_labels?
177
-
178
- @metrics.add("sidekiq_queue_size", queue.size, **labels)
179
- @metrics.add("sidekiq_queue_latency_seconds", queue.latency, **labels)
180
- @metrics.add("sidekiq_queue_paused", queue.paused? ? 1 : 0, **labels)
181
- end
182
- end
183
-
184
- def _probe_jobs_limit(namespace = true)
185
- labels = add_namespace_labels? ? { namespaced: namespace } : {}
186
- job_stats = Hash.new(0)
187
-
188
- Sidekiq::Queue.all.each do |queue|
189
- Sidekiq.redis do |conn|
190
- conn.lrange("queue:#{queue.name}", 0, PROBE_JOBS_LIMIT).each do |job|
191
- job_class = Sidekiq.load_json(job)["class"]
192
-
193
- job_stats[job_class] += 1
194
- end
195
- end
196
- end
197
-
198
- job_stats.each do |class_name, count|
199
- @metrics.add("sidekiq_enqueued_jobs", count, **labels.merge({ name: class_name }))
200
- end
201
- end
202
-
203
- def _probe_retries(namespace = true)
204
- labels = add_namespace_labels? ? { namespaced: namespace } : {}
205
- retry_stats = Hash.new(0)
206
-
207
- Sidekiq::RetrySet.new.map do |job|
208
- retry_stats[job.klass] += 1
209
- end
210
-
211
- retry_stats.each do |class_name, count|
212
- @metrics.add("sidekiq_to_be_retried_jobs", count, **labels.merge({ name: class_name }))
213
- end
214
- end
215
-
216
- def with_sidekiq(namespaced = true)
183
+ def with_sidekiq
217
184
  SIDEKIQ_REDIS_LOCK.synchronize {
218
185
  Sidekiq.configure_client do |config|
219
- config.redis = self.class.connection_pool[redis_options(namespaced)]
186
+ config.redis = self.class.connection_pool[redis_options]
220
187
  end
221
188
 
222
189
  return unless connected?
@@ -225,14 +192,13 @@ module GitLab
225
192
  }
226
193
  end
227
194
 
228
- def redis_options(namespaced = true)
195
+ def redis_options
229
196
  options = {
230
197
  url: @opts[:redis_url],
231
198
  connect_timeout: 1,
232
199
  reconnect_attempts: 0
233
200
  }
234
201
 
235
- options[:namespace] = "resque:gitlab" if namespaced
236
202
  options[:id] = nil unless redis_enable_client?
237
203
  options
238
204
  end
@@ -253,11 +219,6 @@ module GitLab
253
219
  @logger&.error "Error connecting to the Redis: #{e}"
254
220
  @connected = false
255
221
  end
256
-
257
- def add_namespace_labels?
258
- @probe_namespaced && @probe_non_namespaced
259
- end
260
222
  end
261
- # rubocop:enable Metrics/ClassLength
262
223
  end
263
224
  end
@@ -1,5 +1,5 @@
1
1
  module GitLab
2
2
  module Exporter
3
- VERSION = "13.5.0".freeze
3
+ VERSION = "14.1.0".freeze
4
4
  end
5
5
  end
data/spec/cli_spec.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "spec_helper"
2
2
  require "gitlab_exporter/cli"
3
+ require "optparse"
3
4
 
4
5
  context "With valid pair of repositories" do
5
6
  let(:repos) { GitRepoBuilder.new }
@@ -29,3 +30,49 @@ context "With valid pair of repositories" do
29
30
  end
30
31
  end
31
32
  end
33
+
34
+ describe GitLab::Exporter::CLI::Server do
35
+ context "extra-config-command is passed" do
36
+ let(:argv) do
37
+ ["-c", "spec/fixtures/config.yml", "--extra-config-command", extra_config_command]
38
+ .extend(OptionParser::Arguable)
39
+ end
40
+ let(:extra_config_command) { "vault kv get top-secrets" }
41
+ let(:server_cmd) { described_class.new(argv) }
42
+
43
+ before do
44
+ allow(server_cmd).to receive(:run_extra_config_command).and_return(<<~YAML
45
+ probes:
46
+ sidekiq:
47
+ methods:
48
+ - probe_workers
49
+ opts:
50
+ redis_url: redis://hunter1@localhost:9765
51
+ database:
52
+ opts:
53
+ connection_string: postgres://db-admin:hunter1@localhost:6543/main-db
54
+ YAML
55
+ )
56
+ end
57
+
58
+ it "merges the returned YAML from the command with the passed config" do
59
+ expect(server_cmd.merged_config).to eq({
60
+ probes: {
61
+ sidekiq: {
62
+ methods: %w[probe_stats probe_workers],
63
+ opts: {
64
+ redis_url: "redis://hunter1@localhost:9765"
65
+ }
66
+ },
67
+ database: {
68
+ methods: ["probe_db"],
69
+ opts: {
70
+ connection_string:
71
+ "postgres://db-admin:hunter1@localhost:6543/main-db"
72
+ }
73
+ }
74
+ }
75
+ })
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,10 @@
1
+ probes:
2
+ sidekiq:
3
+ methods:
4
+ - probe_stats
5
+
6
+ database:
7
+ methods:
8
+ - probe_db
9
+ opts:
10
+ connection_string: to-be-overridden
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.5.0
4
+ version: 14.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Carranza
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.2.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: deep_merge
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.2
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: faraday
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -229,6 +243,7 @@ files:
229
243
  - spec/database/ci_builds_spec.rb
230
244
  - spec/database/row_count_spec.rb
231
245
  - spec/elasticsearch_spec.rb
246
+ - spec/fixtures/config.yml
232
247
  - spec/fixtures/smaps/sample.txt
233
248
  - spec/git_process_proper_spec.rb
234
249
  - spec/git_spec.rb
@@ -236,7 +251,6 @@ files:
236
251
  - spec/memstats_spec.rb
237
252
  - spec/prometheus_metrics_spec.rb
238
253
  - spec/ruby_spec.rb
239
- - spec/sidekiq_spec.rb
240
254
  - spec/spec_helper.rb
241
255
  - spec/util_spec.rb
242
256
  homepage: https://gitlab.com/gitlab-org/ruby/gems/gitlab-exporter
@@ -268,6 +282,7 @@ test_files:
268
282
  - spec/database/ci_builds_spec.rb
269
283
  - spec/database/row_count_spec.rb
270
284
  - spec/elasticsearch_spec.rb
285
+ - spec/fixtures/config.yml
271
286
  - spec/fixtures/smaps/sample.txt
272
287
  - spec/git_process_proper_spec.rb
273
288
  - spec/git_spec.rb
@@ -275,6 +290,5 @@ test_files:
275
290
  - spec/memstats_spec.rb
276
291
  - spec/prometheus_metrics_spec.rb
277
292
  - spec/ruby_spec.rb
278
- - spec/sidekiq_spec.rb
279
293
  - spec/spec_helper.rb
280
294
  - spec/util_spec.rb
data/spec/sidekiq_spec.rb DELETED
@@ -1,64 +0,0 @@
1
- require "spec_helper"
2
- require "gitlab_exporter/sidekiq"
3
-
4
- describe GitLab::Exporter::SidekiqProber do
5
- let(:probe_list) { %w[probe_stats probe_queues probe_future_sets probe_jobs_limit probe_workers probe_retries] }
6
- let(:opt) { {} }
7
- let(:probe) { described_class.new(**opt) }
8
-
9
- before do
10
- # stub connection as we want check if the probe methods are called
11
- # with the right namespace argument
12
- allow(probe).to receive(:connected?).and_return(true)
13
- end
14
-
15
- context "when no namespace options are defined" do
16
- it "defaults to probing non-namespaced keys only" do
17
- probe_list.each do |probe_type|
18
- expect(probe).not_to receive("_#{probe_type}".to_sym).with(false)
19
- expect(probe).to receive("_#{probe_type}".to_sym).with(no_args)
20
-
21
- probe.send(probe_type)
22
- end
23
- end
24
- end
25
-
26
- context "when probing both namespaces" do
27
- let(:opt) { { probe_non_namespaced: true, probe_namespaced: true } }
28
-
29
- it "probes both namespaces" do
30
- probe_list.each do |probe_type|
31
- expect(probe).to receive("_#{probe_type}".to_sym).with(false)
32
- expect(probe).to receive("_#{probe_type}".to_sym).with(no_args)
33
-
34
- probe.send(probe_type)
35
- end
36
- end
37
- end
38
-
39
- context "when probing non-namespaced only" do
40
- let(:opt) { { probe_non_namespaced: true } }
41
-
42
- it "probes non-namespaced only" do
43
- probe_list.each do |probe_type|
44
- expect(probe).to receive("_#{probe_type}".to_sym).with(false)
45
- expect(probe).not_to receive("_#{probe_type}".to_sym).with(no_args)
46
-
47
- probe.send(probe_type)
48
- end
49
- end
50
- end
51
-
52
- context "when probing namespace only" do
53
- let(:opt) { { probe_namespaced: true } }
54
-
55
- it "probes namespaced only" do
56
- probe_list.each do |probe_type|
57
- expect(probe).not_to receive("_#{probe_type}".to_sym).with(false)
58
- expect(probe).to receive("_#{probe_type}".to_sym).with(no_args)
59
-
60
- probe.send(probe_type)
61
- end
62
- end
63
- end
64
- end