Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/support/shared_examples/metrics
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/support/shared_examples/metrics')
-rw-r--r--spec/support/shared_examples/metrics/sampler_shared_examples.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/support/shared_examples/metrics/sampler_shared_examples.rb b/spec/support/shared_examples/metrics/sampler_shared_examples.rb
new file mode 100644
index 00000000000..ebf199c3a8d
--- /dev/null
+++ b/spec/support/shared_examples/metrics/sampler_shared_examples.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples 'metrics sampler' do |env_prefix|
+ context 'when sampling interval is passed explicitly' do
+ subject { described_class.new(42) }
+
+ specify { expect(subject.interval).to eq(42) }
+ end
+
+ context 'when sampling interval is passed through the environment' do
+ subject { described_class.new }
+
+ before do
+ stub_env("#{env_prefix}_INTERVAL_SECONDS", '42')
+ end
+
+ specify { expect(subject.interval).to eq(42) }
+ end
+
+ context 'when no sampling interval is passed anywhere' do
+ subject { described_class.new }
+
+ it 'uses the hardcoded default' do
+ expect(subject.interval).to eq(described_class::DEFAULT_SAMPLING_INTERVAL_SECONDS)
+ end
+ end
+end